姜永辉 1 год назад
Родитель
Сommit
f05a3e87e2

+ 10 - 0
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -528,7 +528,17 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                t.non_std_code,
                t.remarks
                 ,tmgu.decimal_places    as "decimalPlaces"
+                ,tmgus.unit_name         as "subUnitName"
+                ,tmgu.unit_name         as "unitName"
+                ,t.pack_box
+                ,tmgs.flg_sub_unit       as "flgSubUnit"
+                ,t.outing_box
+                ,t.outing_piece
+                ,t.out_box
+                ,t.out_piece
         FROM dkic_b.t_psi_outbound_item as t
+                 left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
+                 left join dkic_b.t_mst_unit as tmgus on t.sub_unit_id = tmgus.unit_id
                  left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = t.sku_id
                  left join dkic_b.t_mst_unit as tmgu on t.unit_id = tmgu.unit_id
                  left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id

+ 25 - 1
src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml

@@ -100,6 +100,7 @@
         <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
         <result column="addressFull" property="addressFull"/>
         <result column="channel_name" property="channelName"/>
+        <result column="channel_id" property="channelId"/>
         <result column="cus_from_name" property="cusFromName"/>
         <result column="out_reason" property="outReason" typeHandler="UuidTypeHandler"/>
         <result column="out_reason_name" property="outReasonName" />
@@ -193,7 +194,16 @@
         <result column="sku_images" property="skuImages"/>
         <result column="wh_id" property="whId"/>
         <result column="wh_name" property="whName"/>
-
+        <result column="invQty" property="invQty"/>
+        <result column="usableQty" property="usableQty"/>
+        <result column="pack_box" property="packBox"/>
+        <result column="flgSubUnit" property="flgSubUnit"/>
+        <result column="subUnitName" property="subUnitName"/>
+        <result column="unitName" property="unitName"/>
+        <result column="outing_box" property="outingBox"/>
+        <result column="outing_piece" property="outingPiece"/>
+        <result column="out_box" property="box"/>
+        <result column="out_piece" property="piece"/>
     </resultMap>
     <!-- 通用条件列 -->
     <sql id="Condition">
@@ -443,6 +453,7 @@
                tmc.contact_name,
                tmc.contact_phone,
                tmc.channel_id                                    as sales_channel,
+               tmc.channel_id                                    ,
                tmsc.channel_name                                 as channel_name,
                t.sup_id,
                t.out_status,
@@ -1057,6 +1068,9 @@
                  left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
                  Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
                 left join  dkic_b.t_psi_outbound_item  tpoi  on tpoi.out_id = t.out_id
+                left join dkic_b.t_psi_inventory tpi on tpi.inv_id = tpoi.inv_id
+                left join dkic_b.t_mst_unit as tmgu on tpoi.unit_id = tmgu.unit_id
+                left join dkic_b.t_mst_unit as tmgus on tpoi.sub_unit_id = tmgus.unit_id
         inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id  = tpoi.sku_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id  = tmgs.brand_id
         left join dkic_b.t_psi_inventory tpity on tpity.inv_id  = tpoi.inv_id
@@ -1106,6 +1120,16 @@
         tmgs.sku_images AS list_sku_images,
                       tpity.wh_id AS list_wh_id,
                       tmw.wh_name AS list_wh_name
+               ,sys.f_remove_zero(tpi.inv_qty)     as "invQty"
+               ,sys.f_remove_zero(tpi.usable_qty)    as "usableQty"
+               ,tmgus.unit_name         as "list_subUnitName"
+                ,tmgu.unit_name         as "list_unitName"
+                ,tpoi.pack_box  as "list_pack_box"
+                ,tmgs.flg_sub_unit       as "list_flgSubUnit"
+                ,tpoi.outing_box  as "list_outing_box"
+                ,tpoi.outing_piece  as "list_outing_piece"
+                ,tpoi.out_box  as "list_out_box"
+                ,tpoi.out_piece  as "list_out_piece"
     </sql>
 
     <select id="countByCondDetail" resultType="Long">

+ 5 - 5
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -294,12 +294,12 @@
         "outboundAmount",
 
 
-        (SELECT COUNT(1) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id =
-        tmc.cp_id AND tpo.flg_valid AND tpo.out_status = '出库状态-待出库' AND tpo.order_status = '订单状态-成交') AS
+        (SELECT COUNT(1) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-出库中') AS
         "outboundNotQuantity",
 
-        (SELECT sum(tpo.sum_amount) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id =
-        tmc.cp_id AND tpo.flg_valid AND tpo.out_status = '出库状态-待出库' AND tpo.order_status = '订单状态-成交') AS
+        (SELECT sum(tpob.outing_amt) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-出库中') AS
         "outboundNotAmount",
 
 
@@ -307,7 +307,7 @@
         tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销退回库') AS
         "outboundReturnQuantity",
 
-        (SELECT sum(tpob.out_amt) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        (SELECT sum(CASE WHEN tpob.out_status = '出库状态-出库中' THEN tpob.outing_amt ELSE tpob.out_amt END) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
         tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销退回库') AS
         "outboundReturnAmount",
         tma.receipt,

+ 50 - 0
src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java

@@ -50,8 +50,49 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @ApiModelProperty(value = "出库单ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String outId;
+    /**
+     * 库存数量
+     */
+    @Excel(name = "库存数量")
+    @ApiModelProperty(value = "库存数量")
+    private BigDecimal invQty;
 
+    @Excel(name = "可用量")
+    @ApiModelProperty(value = "可用量")
+    private BigDecimal usableQty;
 
+
+    @Excel(name = "包装")
+    @ApiModelProperty(value = "包装")
+    private Integer packBox;
+    /**
+     * 辅助单位标识
+     */
+    @Excel(name = "辅助单位标识")
+    @ApiModelProperty(value = "辅助单位标识")
+    private Boolean flgSubUnit;
+    @Excel(name = "包装单位名称")
+    @ApiModelProperty(value = "包装单位名称")
+    private String subUnitName;
+
+    @Excel(name = "基本单位名称")
+    @ApiModelProperty(value = "基本单位名称")
+    private String unitName;
+    @Excel(name = "箱(出库中)")
+    @ApiModelProperty(value = "箱(出库中)")
+    private  Integer outingBox;
+
+    @Excel(name = "片(出库中)")
+    @ApiModelProperty(value = "片(出库中)")
+    private  Integer outingPiece;
+
+    @Excel(name = "箱(已出库)")
+    @ApiModelProperty(value = "箱(已出库)")
+    private  Integer outBox;
+
+    @Excel(name = "片(已出库)")
+    @ApiModelProperty(value = "片(已出库)")
+    private  Integer outPiece;
     /**
      * 出库单号
      */
@@ -277,7 +318,13 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @ApiModelProperty(value = "出库原因")
     private String outReasonName;
 
+    @Excel(name = "箱")
+    @ApiModelProperty(value = "箱")
+    private  Integer box;
 
+    @Excel(name = "片")
+    @ApiModelProperty(value = "片")
+    private  Integer piece;
 
     @ApiModelProperty(value = "出库单明细")
     private List<OutboundItemResponse> goodsList;
@@ -344,6 +391,9 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @ApiModelProperty(value = "销售渠道")
     private String salesChannel;
 
+    @ApiModelProperty(value = "销售渠道")
+    private String channelId;
+
 
 
     private BigDecimal sumOutAmt;

+ 2 - 2
src/main/java/com/dk/mdm/service/ivt/outbound/OutCommon.java

@@ -66,7 +66,7 @@ public class OutCommon {
                     .setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
                     .setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
                     .setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
-                    .setFollowStaffs(followStaffs)
+                    .setFollowStaffs(followStaffs).setCusFrom(outboundVO.getCusFrom())
                     .setReportStaff(outboundVO.getMakeStaff()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()).setCpId(outboundVO.getCpId());
             customerMapper.insert(customer);
             outboundVO.setCusId(customer.getCusId());
@@ -88,7 +88,7 @@ public class OutCommon {
                     .setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
                     .setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
                     .setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
-                    .setFollowStaffs(followStaffs)
+                    .setFollowStaffs(followStaffs).setCusFrom(outboundVO.getCusFrom())
                     .setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName());
             customerService.updateByUuid(customer);
         }

+ 4 - 0
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -494,6 +494,10 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
         //endregion
         //region 大编辑
         else {
+            // region 更新客户信息
+            outboundVO = outCommon.insertCustomer(outboundVO);
+            // endregion
+
             //region 根据id查询   并且明细数量金额  求和
             OutboundResponse outboundResponse = outboundMapper.selectById(outboundVO.getOutId());
             BigDecimal sumQty = outboundVO.getItemList().stream().map(OutboundItemVO::getOutingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);