Просмотр исходного кода

Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into master_liaozeyong

廖泽勇 4 недель назад
Родитель
Сommit
59e2f94fc7

BIN
jshERP-web/public/doc/goods_template.xls


+ 3 - 3
jshERP-web/src/views/material/MaterialList.vue

@@ -367,8 +367,8 @@ export default {
           },
         },
         { title: '基础重量', dataIndex: 'weight', width: 80 },
-        { title: '保质期', dataIndex: 'expiryNum', width: 60 },
-        { title: '制造商', dataIndex: 'mfrs', width: 120, ellipsis: true },
+        // { title: '保质期', dataIndex: 'expiryNum', width: 60 },
+        // { title: '制造商', dataIndex: 'mfrs', width: 120, ellipsis: true },
         {
           title: '初始库存',
           dataIndex: 'initialStock',
@@ -380,7 +380,7 @@ export default {
         { title: '零售价', dataIndex: 'commodityDecimal', width: 80 },
         { title: '销售价', dataIndex: 'wholesaleDecimal', width: 80 },
         { title: '最低售价', dataIndex: 'lowDecimal', width: 80 },
-        { title: '仓位货架', dataIndex: 'position', width: 80 },
+        // { title: '仓位货架', dataIndex: 'position', width: 80 },
         { title: '备注', dataIndex: 'remark', width: 80 },
         {
           title: '状态',

+ 1 - 0
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -281,6 +281,7 @@ public class DepotItemController {
                     item.put("supplierName",diEx.getSupplierName());
                     item.put("unitId",diEx.getUnitId());
                     item.put("unitList",diEx.getUnitId() == null ? null : unitService.getUnitListByID(diEx.getUnitId()));
+                    item.put("unitName", diEx.getUnitName());
                     item.put("actualQuantityInStorage",diEx.getActualQuantityInStorage());
                     item.put("warehousingVariance",diEx.getWarehousingVariance());
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());

+ 3 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotHead.java

@@ -147,6 +147,9 @@ public class DepotHead {
     @ApiModelProperty("收货人地址")
     private String receiverAddress;
 
+    @ApiModelProperty("仓库id")
+    private Long depotId;
+
     @ApiModelProperty("操作人")
     private Long operId;
 

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

@@ -1,9 +1,7 @@
 package com.jsh.erp.datasource.entities;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 

+ 19 - 0
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -1198,6 +1198,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             Long headId = list.get(0).getId();
             /**入库和出库处理单据子表信息*/
             depotItemService.saveDetials(rows,headId, "add",request);
+            updateTotalPriceById(list.get(0));
         }
         logService.insertLog("单据",
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depotHead.getNumber()).toString(),
@@ -1315,6 +1316,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         }
         /**入库和出库处理单据子表信息*/
         depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
+        updateTotalPriceById(depotHead);
         logService.insertLog("单据",
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).toString(),
                 ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -2031,4 +2033,21 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         return true;
     }
 
+    /**
+     * 修改订单总额
+     */
+    private void updateTotalPriceById(DepotHead depotHead) throws Exception {
+        BigDecimal sum = BigDecimal.ZERO;
+        //获取单据子表
+        List<DepotItem> list = depotItemService.getListByHeaderId(depotHead.getId());
+        for (DepotItem depotItem : list) {
+            sum = sum.add(depotItem.getTaxLastMoney());
+        }
+        BigDecimal totalPrice = sum;
+        if (depotHead.getTotalPrice().compareTo(BigDecimal.ZERO) < 0){
+            totalPrice = totalPrice.negate();
+        }
+        update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("change_amount",totalPrice).set("discount_last_money",sum).eq("id",list.get(0).getId()));
+    }
+
 }

+ 22 - 4
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -597,7 +597,8 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     depotItem.setOperNumber(rowObj.getBigDecimal("operNumber"));
                     //获取子表单商品单位
                     String unit = rowObj.get("unit") == null ? "" :rowObj.get("unit").toString();
-                    BigDecimal oNumber = rowObj.getBigDecimal("operNumber");
+                    //获取实际出入库数量
+                    BigDecimal oNumber = rowObj.getBigDecimal("actualQuantityInStorage");
                     if (StringUtil.isNotEmpty(unitInfo.getName())) {
                         String basicUnit = unitInfo.getBasicUnit(); //基本单位
                         if (unit.equals(basicUnit)) { //如果等于基本单位
@@ -680,11 +681,18 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                         depotItem.setPurchaseUnitPrice(getDepotItemByBatchNumber(depotItem.getMaterialExtendId(),depotItem.getBatchNumber()).getUnitPrice());
                     }
                 }
+                //含税单价
                 if (StringUtil.isExist(rowObj.get("taxUnitPrice"))) {
                     depotItem.setTaxUnitPrice(rowObj.getBigDecimal("taxUnitPrice"));
                 }
+                //总金额,不含税
                 if (StringUtil.isExist(rowObj.get("allPrice"))) {
-                    depotItem.setAllPrice(rowObj.getBigDecimal("allPrice"));
+                    if (depotItem.getActualQuantityInStorage() == null || depotItem.getActualQuantityInStorage().equals(BigDecimal.ZERO)){
+                        depotItem.setAllPrice(rowObj.getBigDecimal("allPrice"));
+                    }else {
+                        //基本单位数量*单价
+                        depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
+                    }
                 }
                 if (StringUtil.isExist(rowObj.get("depotId"))) {
                     depotItem.setDepotId(rowObj.getLong("depotId"));
@@ -709,14 +717,24 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                 String.format(ExceptionConstants.DEPOT_HEAD_ANOTHER_DEPOT_FAILED_MSG));
                     }
                 }
+                //税率
                 if (StringUtil.isExist(rowObj.get("taxRate"))) {
                     depotItem.setTaxRate(rowObj.getBigDecimal("taxRate"));
                 }
+                //税额
                 if (StringUtil.isExist(rowObj.get("taxMoney"))) {
-                    depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
+                    if (depotItem.getActualQuantityInStorage() == null || depotItem.getActualQuantityInStorage().equals(BigDecimal.ZERO)){
+                        depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
+                    }else {
+                        //单价总金额*税率
+                        depotItem.setTaxMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()));
+                    }
                 }
+                //价税合计
                 if (StringUtil.isExist(rowObj.get("taxLastMoney"))) {
-                    depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
+                    //单价总额 + 税额
+                    depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney()));
+                    //depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
                 }
                 if (StringUtil.isExist(rowObj.get("mType"))) {
                     depotItem.setMaterialType(rowObj.getString("mType"));

+ 6 - 3
src/main/resources/mapper_xml/DepotHeadMapper.xml

@@ -514,10 +514,10 @@
       <if test="record.voucherPicture != null">
         voucher_picture = #{record.voucherPicture,jdbcType=VARCHAR},
       </if>
-      <if test="record.goodsQuantity != null">
+      <if test="record.goodsQuantity != null and record.goodsQuantity != 0">
         goods_quantity = #{record.goodsQuantity,jdbcType=INTEGER},
       </if>
-      <if test="record.goodsTypeCount != null">
+      <if test="record.goodsTypeCount != null and record.goodsTypeCount != 0">
         goods_type_count = #{record.goodsTypeCount,jdbcType=INTEGER},
       </if>
       <if test="record.linkTesco != null">
@@ -699,8 +699,11 @@
       <if test="receiverAddress != null">
         receiver_address = #{receiverAddress,jdbcType=VARCHAR},
       </if>
+      <if test="depotId != null">
+        depot_id = #{depotId,jdbcType=BIGINT},
+      </if>
       <if test="operId != null">
-        oper_id = #{operId,jdbcType=VARCHAR}
+        oper_id = #{operId,jdbcType=BIGINT}
       </if>
     </set>
     where id = #{id,jdbcType=BIGINT}

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

@@ -322,13 +322,14 @@
         select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
         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
+        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName,u.name unit_name
         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'
         left join jsh_depot dp1 on di.depot_id=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
         left join jsh_depot dp2 on di.another_depot_id=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
         left JOIN jsh_supplier s on me.supplier_id = s.id and ifnull(s.delete_Flag,'0') !='1'
+        left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
         where di.header_id = #{headerId}
         and ifnull(di.delete_flag,'0') !='1'
         order by di.id asc