Browse Source

Merge remote-tracking branch 'origin/dev_huangjunjie'

yz 1 week ago
parent
commit
059c96432b

+ 4 - 3
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -276,7 +276,7 @@ public class DepotItemController {
                     item.put("anotherDepotName", diEx.getAnotherDepotId() == null ? "" : diEx.getAnotherDepotName());
                     item.put("mType", diEx.getMaterialType());
                     item.put("op", 1);
-                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",diEx.getProductionDate());
+                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getProductionDate());
                     item.put("productionDate",productionDate);
                     item.put("expiryNum",diEx.getExpiryNum());
                     item.put("supplierId",diEx.getSupplierId());
@@ -290,11 +290,12 @@ public class DepotItemController {
                     item.put("warehousingVariance",diEx.getWarehousingVariance());
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());
                     item.put("warehousingUser",diEx.getWarehousingUser());
-                    item.put("warehousingTime",diEx.getWarehousingTime());
+                    item.put("warehousingTime",diEx.getWarehousingTime() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getWarehousingTime()));
                     item.put("warehousingUserName",diEx.getWarehousingUserName());
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
                     item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
                     item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
+                    item.put("ratio",diEx.getRatio());
                     dataArray.add(item);
                     //合计数据汇总
                     totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());
@@ -1041,7 +1042,7 @@ public class DepotItemController {
                         taxRate = ExcelUtils.getContent(src, i, 4);
                         remark = ExcelUtils.getContent(src, i, 5);
                     }
-                    if("CGRK".equals(prefixNo) || "XSCK".equals(prefixNo)) {
+                    if("CGRK".equals(prefixNo)) {
                         //采购入库
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);

+ 2 - 1
src/main/java/com/jsh/erp/datasource/entities/DepotItem.java

@@ -103,7 +103,8 @@ public class DepotItem {
     private Long warehousingUser;
 
     @ApiModelProperty("出入库时间")
-    private String warehousingTime;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date warehousingTime;
 
     @ApiModelProperty("创建时间")
     private Date createTime;

+ 2 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -1,5 +1,6 @@
 package com.jsh.erp.datasource.entities;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -60,6 +61,7 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     private String brand;
 
     @ApiModelProperty("生产日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date productionDate;
 
     @ApiModelProperty("保质期天数")

+ 7 - 2
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -1331,6 +1331,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         /**入库和出库处理单据子表信息*/
         depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
         //修改订单总额
+        updateTotalPriceById(depotHead);
 //        if (depotHead.getSubType().equals("采购") || depotHead.getSubType().equals("销售")){
 //            updateTotalPriceById(depotHead);
 //        }
@@ -2002,6 +2003,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         depotHead.setRemark(pdaDepotHeadDTO.getRemark());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         depotHead.setStatus("2");
+        depotHead.setOtherMoney(BigDecimal.ZERO);
         //添加主表
         depotHeadMapper.insertSelective(depotHead);
         //根据单据编号查询单据id
@@ -2118,8 +2120,11 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             if (depotHead.getTotalPrice().compareTo(BigDecimal.ZERO) < 0){
                 totalPrice = totalPrice.negate();
             }
-            this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
-
+            if ("采购".equals(depotHead.getSubType()) || "销售".equals(depotHead.getSubType()) && depotHead.getChangeAmount().compareTo(BigDecimal.ZERO) == 0){
+                this.update(new UpdateWrapper<DepotHead>().set("change_amount",totalPrice).set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+            }else {
+                this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+            }
     }
 
 }

+ 11 - 8
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -551,7 +551,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //出入库用户
                 depotItem.setWarehousingUser(rowObj.getLong("warehousingUser"));
                 //warehousingTime
-                depotItem.setWarehousingTime(rowObj.getString("warehousingTime"));
+                depotItem.setWarehousingTime(rowObj.getDate("warehousingTime"));
                 //生产日期
                 depotItem.setProductionDate(rowObj.getDate("productionDate"));
                 //保质期天数
@@ -1614,13 +1614,14 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                     if(StringUtil.isNotEmpty(detailMap.get("unitPrice"))) {
                         unitPrice = new BigDecimal(detailMap.get("unitPrice"));
-                    } else {
-                        if("CGDD".equals(prefixNo)) {
-                            unitPrice = m.getPurchaseDecimal();
-                        } else if("XSDD".equals(prefixNo)) {
-                            unitPrice = m.getWholesaleDecimal();
-                        }
                     }
+//                    else {
+//                        if("CGDD".equals(prefixNo)) {
+//                            unitPrice = m.getPurchaseDecimal();
+//                        } else if("XSDD".equals(prefixNo)) {
+//                            unitPrice = m.getWholesaleDecimal();
+//                        }
+//                    }
                     if(StringUtil.isNotEmpty(detailMap.get("taxRate"))) {
                         taxRate = new BigDecimal(detailMap.get("taxRate"));
                     }
@@ -1630,7 +1631,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     item.put("productionDate",detailMap.get("productionDate"));
                     BigDecimal allPrice = BigDecimal.ZERO;
                     if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
-                        allPrice = unitPrice.multiply(operNumber);
+                        allPrice = unitPrice.multiply(operNumber).multiply(m.getRatio());
                     }
                     BigDecimal taxMoney = BigDecimal.ZERO;
                     if(taxRate.compareTo(BigDecimal.ZERO) != 0) {
@@ -1646,6 +1647,8 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     item.put("wholesaleDecimal",m.getDefaultWholesaleDecimal());
                     item.put("defaultPurchaseDecimal",m.getDefaultPurchaseDecimal());
                     item.put("defaultWholesaleDecimal",m.getDefaultWholesaleDecimal());
+                    item.put("ratio",m.getRatio());
+                    item.put("unitName",m.getUnitName());
                     arr.add(item);
                 } else {
                     throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java

@@ -685,7 +685,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
                 // 结算方式
                 objs[12] = mapSettlementMethod(s.getSettlementMethod());
                 // 账单周期
-                objs[13] = s.getBillingCycleDays() == null? "" : s.getBillingCycleDays().toString();
+                objs[13] = s.getBillingCycleDays() == null ? "" : s.getBillingCycleDays() == 1 ? "先款后货" : "先货后款";
                 // 采购对接人
                 objs[14] = s.getProcurementContact();
                 // 到货天数

+ 3 - 3
src/main/resources/mapper_xml/DepotItemMapper.xml

@@ -240,7 +240,7 @@
       <if test="warehousingUser != null">
         warehousing_user,
       </if>
-      <if test="warehousingTime != null and warehousingTime != ''">
+      <if test="warehousingTime != null">
         warehousing_time,
       </if>
       <if test="createTime != null">
@@ -347,8 +347,8 @@
       <if test="warehousingUser != null">
         #{warehousingUser,jdbcType=BIGINT},
       </if>
-      <if test="warehousingTime != null and warehousingTime != ''">
-        #{warehousingTime,jdbcType=DATE},
+      <if test="warehousingTime != null">
+        #{warehousingTime},
       </if>
       <if test="createTime != null">
         #{createTime,jdbcType=DATE},

+ 2 - 2
src/main/resources/mapper_xml/DepotItemMapperEx.xml

@@ -322,7 +322,7 @@
         m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
         m.brand, dp1.name DepotName,dp2.name AnotherDepotName, me.purchase_decimal,
         me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName,u.name unit_name,me.inventory,
-        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal
+        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal,me.ratio
         from jsh_depot_item di
         left join jsh_material m on di.material_id=m.id  and ifnull(m.delete_flag,'0') !='1'
         left join jsh_material_extend me on me.id=di.material_extend_id  and ifnull(me.delete_Flag,'0') !='1'
@@ -1106,7 +1106,7 @@
     <select id="getBillItemByParam" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
         select m.*,u.name unit_name, me.id meId, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
         me.wholesale_decimal, me.low_decimal, me.sku,
-        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position,d.`name` depotName,s.supplier supplierName
+        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position,d.`name` depotName,s.supplier supplierName,me.ratio
         from jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
         left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'