Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

dongke 1 an în urmă
părinte
comite
0b4b9bb2e5

+ 6 - 4
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -181,6 +181,7 @@
         <result column="sub_unit_code" property="subUnitCode"/>
         <result column="sub_unit_name" property="subUnitName"/>
         <result column="pack_box" property="packBox"/>
+        <result column="sItemAmt" property="sItemAmt"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -557,7 +558,7 @@
         tpii.non_std_code,
         tpii.into_status,
       --   sys.f_remove_zero(tpii.into_qty - tpii.return_qty)  AS can_return_qty,
-        sys.f_remove_zero(COALESCE(tpsii.into_qty, 0) - COALESCE(tpsii.return_qty, 0) + tpii.intoing_qty + tpii.into_qty) as can_return_qty,
+        -sys.f_remove_zero ( COALESCE ( tpsii.into_qty, 0 )  + tpii.intoing_qty) AS can_return_qty,
         sys.f_remove_zero(tpii.intoing_qty + tpii.into_qty)               as intoing_qty,
         sys.f_remove_zero(tpii.intoing_amt + tpii.into_amt)   as intoing_amt,
         sys.f_remove_zero ( tpii.into_qty ) AS into_qty,
@@ -569,7 +570,7 @@
         tpii.cost_price,
         tpii.cost_amt,
         sys.f_remove_zero ( tpii.out_qty ) AS out_qty,
-        sys.f_remove_zero ( tpii.inv_qty ) AS inv_qty,
+        sys.f_remove_zero ( tpi.inv_qty ) AS inv_qty,
         tpii.flg_valid,
         tpii.cp_id,
         tpii.s_into_id,
@@ -608,7 +609,8 @@
         tppi.return_amt AS "sPurItemReturnAmt",
         sys.f_remove_zero ( tpi.usable_qty ) AS "usableQty",
         tpi.non_std_code AS "non_std_code",
-        ( SELECT ul.decimal_places FROM dkic_b.t_mst_unit ul WHERE tpii.unit_id = ul.unit_id ) AS "decimalPlaces"
+        ( SELECT ul.decimal_places FROM dkic_b.t_mst_unit ul WHERE tpii.unit_id = ul.unit_id ) AS "decimalPlaces",
+        tppi.item_amt AS "sItemAmt"
         FROM
         dkic_b.t_psi_inbound_item tpii
         LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
@@ -1143,7 +1145,7 @@
                 AND tpii.into_id = #{intoId}::uuid
             </if>
             <if test="fromId != null and fromId != ''">
-                AND tpoi.from_id = #{fromId}::uuid
+                AND tpii.from_id = #{fromId}::uuid
             </if>
         </where>
     </select>

+ 183 - 6
src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml

@@ -208,6 +208,8 @@
         <result column="pack_box_text" property="packBoxText"/>
         <result column="can_return_qty" property="canReturnQty"/>
         <result column="price_into" property="priceInto"/>
+        <result column="sku_spec" property="skuSpec"/>
+        <result column="decimalPlaces" property="decimalPlaces"/>
 
     </resultMap>
 
@@ -310,6 +312,7 @@
             <if test="intoStatus != null and intoStatus != ''">
                  AND tpi.into_status LIKE concat('%',my_ex.likequery(#{intoStatus}),'%')
             </if>
+
             <if test="skuModel != null and skuModel!='' ">
                 and exists (select 1 from dkic_b.t_psi_inbound_item tpii
                 left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpii.sku_id
@@ -666,6 +669,7 @@
         sys.f_remove_zero(tpii.into_qty)  AS list_into_qty,
         tpii.into_amt AS list_into_amt,
         sys.f_remove_zero(tpii.return_qty) AS list_return_qty,
+        ( SELECT ul.decimal_places FROM dkic_b.t_mst_unit ul WHERE tpii.unit_id = ul.unit_id ) AS "list_decimalPlaces",
         tpii.return_amt AS list_return_amt,
         tpii.remarks AS list_remarks,
         tpii.inv_id AS list_inv_id,
@@ -681,7 +685,7 @@
         tmgb.short_name AS  list_short_name,
         tmgs.sku_images AS  list_sku_images,
         tmgs.price_standard AS list_price_std,
-
+        tmgs.sku_spec          as "list_sku_spec",
         i.inv_id  as list_inv_id,
         i.wh_id as list_wh_id,
         i.inv_qty    as list_inv_qty,
@@ -1197,7 +1201,95 @@
         else true end as "paymentFlag"
         FROM dkic_b.t_psi_inbound tpi
         <include refid="Join_Table_Return"/>
-        <include refid="Condition"/>
+        <where>
+                <if test="intoNo != null and intoNo != ''">
+                    AND tpi.into_no LIKE concat('%',my_ex.likequery(#{intoNo}),'%')
+                </if>
+                <if test="intoType != null and intoType != ''">
+                    AND tpi.into_type LIKE concat('%',my_ex.likequery(#{intoType}),'%')
+                </if>
+                <if test="intoTypes != null and intoTypes.size()>0">
+                    AND tpi.into_type =any(#{intoTypes,typeHandler=StringListTypeHandler})
+                </if>
+                <if test="intoReasonList != null and intoReasonList.size()>0">
+                    AND tpi.into_reason =any(#{intoReasonList,typeHandler=UuidListTypeHandler})
+                </if>
+                <if test="searchText !=null and searchText != ''">
+                    AND (
+                    tpi.into_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                    or tmp.return_address LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                    or tmp.contact_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                    or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                    )
+                </if>
+                <if test="staffIds != null and staffIds.size()>0">
+                    AND t.staff_id = any(#{staffIds, typeHandler=uuidListTypeHandler})
+                </if>
+                <if test="orgIds != null and orgIds.size()>0">
+                    AND t.org_id = any(#{orgIds, typeHandler=uuidListTypeHandler})
+                </if>
+                <if test="fromId != null and fromId != ''">
+                    AND tpi.from_id = #{fromId}::uuid
+                </if>
+                <if test="fromNo != null and fromNo != ''">
+                    AND tpi.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
+                </if>
+                <if test="orgId != null and orgId != ''">
+                    AND tpi.org_id = #{orgId}::uuid
+                </if>
+                <if test="orgName != null and orgName != ''">
+                    AND tmo.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+                </if>
+                <if test="supName != null and supName != ''">
+                    AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
+                </if>
+                <if test="staffName != null and staffName != ''">
+                    AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
+                </if>
+                <if test="whName != null and whName != ''">
+                    AND tmw.wh_name LIKE concat('%',my_ex.likequery(#{whName}),'%')
+                </if>
+                <if test="staffId != null and staffId != ''">
+                    AND tpi.staff_id = #{staffId}::uuid
+                </if>
+
+                <if test="supId != null and supId != ''">
+                    AND tpi.sup_id = #{supId}::uuid
+                </if>
+                <if test="makeStaff != null and makeStaff != ''">
+                    AND tpi.make_staff = #{makeStaff}
+                </if>
+                <if test="viewVoidedDocuments !=null and viewVoidedDocuments == false">
+                    AND  tpi.flg_valid = true
+                </if>
+                <if test="makeTime != null">
+                    AND tpi.make_time = #{makeTime}
+                </if>
+                <if test="receivableId != null and receivableId != ''">
+                    AND tpi.receivable_id = #{receivableId}
+                </if>
+                <if test="flgValid != null">
+                    AND tpi.flg_valid = #{flgValid}
+                </if>
+                <if test="cpId != null">
+                    AND tpi.cp_id = #{cpId}
+                </if>
+                <if test="intoDateStart != null and intoDateEnd != null">
+                    AND tpi.into_date &gt;= #{intoDateStart}::timestamp with time zone
+                    AND tpi.into_date &lt; #{intoDateEnd}::timestamp with time zone + interval '1 day'
+                </if>
+                <if test="makeTimeStart != null and makeTimeEnd != null">
+                    AND tpi.make_time &gt;= #{makeTimeStart}::timestamp with time zone
+                    AND tpi.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
+                </if>
+                <if test="intoStatusList != null and intoStatusList.size()>0">
+                    AND tpi.into_status =
+                    any(#{intoStatusList, typeHandler= StringListTypeHandler})
+                </if>
+                <if test="intoStatus != null and intoStatus != ''">
+                    AND tpi.into_status LIKE concat('%',my_ex.likequery(#{intoStatus}),'%')
+                </if>
+        </where>
         ORDER BY tpi.op_create_time DESC
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -1209,7 +1301,95 @@
         count(1)
         FROM dkic_b.t_psi_inbound tpi
         <include refid="Join_Table_Return"/>
-        <include refid="Condition"/>
+        <where>
+            <if test="intoNo != null and intoNo != ''">
+                AND tpi.into_no LIKE concat('%',my_ex.likequery(#{intoNo}),'%')
+            </if>
+            <if test="intoType != null and intoType != ''">
+                AND tpi.into_type LIKE concat('%',my_ex.likequery(#{intoType}),'%')
+            </if>
+            <if test="intoTypes != null and intoTypes.size()>0">
+                AND tpi.into_type =any(#{intoTypes,typeHandler=StringListTypeHandler})
+            </if>
+            <if test="intoReasonList != null and intoReasonList.size()>0">
+                AND tpi.into_reason =any(#{intoReasonList,typeHandler=UuidListTypeHandler})
+            </if>
+            <if test="searchText !=null and searchText != ''">
+                AND (
+                tpi.into_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmp.return_address LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmp.contact_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+                )
+            </if>
+            <if test="staffIds != null and staffIds.size()>0">
+                AND t.staff_id = any(#{staffIds, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="orgIds != null and orgIds.size()>0">
+                AND t.org_id = any(#{orgIds, typeHandler=uuidListTypeHandler})
+            </if>
+            <if test="fromId != null and fromId != ''">
+                AND tpi.from_id = #{fromId}::uuid
+            </if>
+            <if test="fromNo != null and fromNo != ''">
+                AND tpi.from_no LIKE concat('%',my_ex.likequery(#{fromNo}),'%')
+            </if>
+            <if test="orgId != null and orgId != ''">
+                AND tpi.org_id = #{orgId}::uuid
+            </if>
+            <if test="orgName != null and orgName != ''">
+                AND tmo.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+            </if>
+            <if test="supName != null and supName != ''">
+                AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
+            </if>
+            <if test="staffName != null and staffName != ''">
+                AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
+            </if>
+            <if test="whName != null and whName != ''">
+                AND tmw.wh_name LIKE concat('%',my_ex.likequery(#{whName}),'%')
+            </if>
+            <if test="staffId != null and staffId != ''">
+                AND tpi.staff_id = #{staffId}::uuid
+            </if>
+
+            <if test="supId != null and supId != ''">
+                AND tpi.sup_id = #{supId}::uuid
+            </if>
+            <if test="makeStaff != null and makeStaff != ''">
+                AND tpi.make_staff = #{makeStaff}
+            </if>
+            <if test="viewVoidedDocuments !=null and viewVoidedDocuments == false">
+                AND  tpi.flg_valid = true
+            </if>
+            <if test="makeTime != null">
+                AND tpi.make_time = #{makeTime}
+            </if>
+            <if test="receivableId != null and receivableId != ''">
+                AND tpi.receivable_id = #{receivableId}
+            </if>
+            <if test="flgValid != null">
+                AND tpi.flg_valid = #{flgValid}
+            </if>
+            <if test="cpId != null">
+                AND tpi.cp_id = #{cpId}
+            </if>
+            <if test="intoDateStart != null and intoDateEnd != null">
+                AND tpi.into_date &gt;= #{intoDateStart}::timestamp with time zone
+                AND tpi.into_date &lt; #{intoDateEnd}::timestamp with time zone + interval '1 day'
+            </if>
+            <if test="makeTimeStart != null and makeTimeEnd != null">
+                AND tpi.make_time &gt;= #{makeTimeStart}::timestamp with time zone
+                AND tpi.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
+            </if>
+            <if test="intoStatusList != null and intoStatusList.size()>0">
+                AND tpi.into_status =
+                any(#{intoStatusList, typeHandler= StringListTypeHandler})
+            </if>
+            <if test="intoStatus != null and intoStatus != ''">
+                AND tpi.into_status LIKE concat('%',my_ex.likequery(#{intoStatus}),'%')
+            </if>
+        </where>
     </select>
     <!--    查看来源单据,总单加明细  采购退货用-->
     <select id="selectInboundReturnById" resultMap="BaseResultMapInboundReturnResponse">
@@ -1227,12 +1407,9 @@
         ,case when tpi.receivable_id is null then false
         when tmai.amt_handle = 0 then false
         else true end as "paymentFlag"
-        ,tpp.sum_amount AS "purSumAmount"
-        ,tpp.return_amt AS "purReturnAmt"
         ,sys.f_get_name_i18n(tdktype.kind_name_i18n,  #{i18n}) AS  "intoStatusName"
         FROM dkic_b.t_psi_inbound tpi
         Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
-        Left join dkic_b.t_psi_purchase tpp on tpp.pur_id = tpi.from_id
         Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
         Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
         Left join dkic_b.t_mst_staff tms1 on tms1.staff_id = tpi.make_staff

+ 2 - 2
src/main/java/com/dk/mdm/model/query/ivt/InboundQuery.java

@@ -243,8 +243,8 @@ public class InboundQuery extends PageInfo<InboundQuery>{
     @ApiModelProperty(value = "出库状态 (【系统字典】)")
     private String outStatus;
 
-
-
+    @ApiModelProperty(value = "查询作废标识")
+    private Boolean viewVoidedDocuments;
 
     private static final long serialVersionUID = 1L;
 

+ 5 - 0
src/main/java/com/dk/mdm/model/response/ivt/InboundItemResponse.java

@@ -529,6 +529,11 @@ public class InboundItemResponse  {
 
     private BigDecimal canReturnQty;
 
+    private BigDecimal sItemAmt;
+
+    @ApiModelProperty(value = "其他入库编辑传给库存标识,true:库存为0时改为无效,false:库位为0时不用动")
+    private  Boolean  updateOtherIntoInvFlag;
+
 
 
     private static final long serialVersionUID = 1L;

+ 3 - 0
src/main/java/com/dk/mdm/model/vo/ivt/InboundVO.java

@@ -263,6 +263,9 @@ public class InboundVO {
     @JsonProperty(value = "sPurId")
     private String sPurId;
 
+    @ApiModelProperty(value = "供应商地址")
+    private String returnAddress;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 8 - 8
src/main/java/com/dk/mdm/service/ivt/InboundReturnService.java

@@ -130,8 +130,8 @@ public class InboundReturnService extends BaseService<Inbound> {
         if (purchaseResponse != null) {
             //反写采购订单退货数量、金额
             purchaseMapper.updateAmount(new Purchase().setPurId(inboundVO.getSPurId())
-                    .setReturnQty(purchaseResponse.getReturnQty().add(inboundVO.getReturnQty()))
-                    .setReturnAmt(purchaseResponse.getReturnAmt().add(inboundVO.getReturnAmt()))
+                    .setReturnQty(purchaseResponse.getReturnQty().add(inboundVO.getIntoingQty().abs()))
+                    .setReturnAmt(purchaseResponse.getReturnAmt().add(inboundVO.getIntoingAmt().abs()))
             );
         }
 
@@ -139,8 +139,8 @@ public class InboundReturnService extends BaseService<Inbound> {
         InboundResponse inboundResponse = inboundMapper.selectById(inboundVO.getFromId());
         if (inboundResponse != null) {
             inboundMapper.updateAmount(new Inbound().setIntoId(inboundVO.getFromId())
-                    .setReturnQty(inboundResponse.getReturnQty().add(inboundVO.getReturnQty()))
-                    .setReturnAmt(inboundResponse.getReturnAmt().add(inboundVO.getReturnAmt())));
+                    .setReturnQty(inboundResponse.getReturnQty().add(inboundVO.getIntoingQty().abs()))
+                    .setReturnAmt(inboundResponse.getReturnAmt().add(inboundVO.getIntoingAmt().abs())));
         }
 
 
@@ -153,8 +153,8 @@ public class InboundReturnService extends BaseService<Inbound> {
                 purchaseItemMapper.updateAmount(
                         new PurchaseItem()
                                 .setItemId(inboundItemVO.getSPurItemId())
-                                .setReturnQty(purchaseItemResponse.getReturnQty().add(inboundItemVO.getReturnQty().setScale(6, BigDecimal.ROUND_HALF_UP)))
-                                .setReturnAmt(purchaseItemResponse.getReturnAmt().add(inboundItemVO.getReturnAmt().setScale(6, BigDecimal.ROUND_HALF_UP)))
+                                .setReturnQty(purchaseItemResponse.getReturnQty().add(inboundItemVO.getIntoingQty().abs().setScale(6, BigDecimal.ROUND_HALF_UP)))
+                                .setReturnAmt(purchaseItemResponse.getReturnAmt().add(inboundItemVO.getIntoingAmt().abs().setScale(6, BigDecimal.ROUND_HALF_UP)))
 
                 );
             }
@@ -166,8 +166,8 @@ public class InboundReturnService extends BaseService<Inbound> {
                 inboundItemMapper.updateAmount(
                         new InboundItem()
                                 .setItemId(inboundItemVO.getSIntoItemId())
-                                .setReturnQty(inboundItemResponse.getReturnQty().add(inboundItemVO.getReturnQty().setScale(6, BigDecimal.ROUND_HALF_UP)))
-                                .setReturnAmt(inboundItemResponse.getReturnAmt().add(inboundItemVO.getReturnAmt().setScale(6, BigDecimal.ROUND_HALF_UP)))
+                                .setReturnQty(inboundItemResponse.getReturnQty().add(inboundItemVO.getIntoingQty().abs().setScale(6, BigDecimal.ROUND_HALF_UP)))
+                                .setReturnAmt(inboundItemResponse.getReturnAmt().add(inboundItemVO.getIntoingAmt().abs().setScale(6, BigDecimal.ROUND_HALF_UP)))
                 );
             }
 

+ 9 - 2
src/main/java/com/dk/mdm/service/ivt/inbound/InboundOtherService.java

@@ -261,6 +261,7 @@ public class InboundOtherService extends BaseService<Inbound> {
      */
     @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<?> otherInboundUpdate(InboundVO inboundVO) {
+
         //region 小编辑
         if (!inboundVO.getLimitEdit()) {
             Inbound inbound = new Inbound();
@@ -282,6 +283,7 @@ public class InboundOtherService extends BaseService<Inbound> {
             }
         }
         //endregion
+
         //region 大编辑
         else {
             //region 明细数量金额  求和
@@ -309,7 +311,8 @@ public class InboundOtherService extends BaseService<Inbound> {
                         inboundItemVO.setIntoQty(inboundItemVO.getIntoingQty());
                         inboundItemVO.setIntoAmt(inboundItemVO.getIntoingAmt());
                         inboundItemVO.setAddOrEditFlag(false);
-                        inboundItemVO.setUpdateOtherIntoInvFlag(true);
+                        //todo 2024年7月17日15:06:51 在查询的地方处理了
+//                        inboundItemVO.setUpdateOtherIntoInvFlag(true);
                         //endregion
 
                         InboundItem inboundItem = new InboundItem();
@@ -361,7 +364,8 @@ public class InboundOtherService extends BaseService<Inbound> {
                         //region 将库存需要的参数赋值
                         inboundItemVO.setInventoryType(Constant.InventoryType.INBOUND.getName());
                         inboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.OTHER_INBOUND.getValue());
-                        inboundItemVO.setUpdateOtherIntoInvFlag(true);
+                        //todo 2024年7月17日15:06:51 在查询的地方处理了
+//                        inboundItemVO.setUpdateOtherIntoInvFlag(true);
                         //endregion
 
                         if (inboundItemVO.getItemId() != null) {
@@ -469,6 +473,7 @@ public class InboundOtherService extends BaseService<Inbound> {
 
         }
         //endregion
+
         return ResponseResultUtil.success(inboundVO);
     }
 
@@ -738,6 +743,8 @@ public class InboundOtherService extends BaseService<Inbound> {
             inboundItemResponse.setInventoryDocCode(Constant.InventoryDocCode.OTHER_INBOUND.getValue());
             inboundItemResponse.setIntoQty(inboundItemResponse.getIntoQty().negate());
             inboundItemResponse.setIntoAmt(inboundItemResponse.getIntoAmt().negate());
+            //endregion
+
             //region
             InboundItem inboundItem = new InboundItem();
             inboundItem

+ 20 - 12
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseReturnService.java

@@ -15,10 +15,12 @@ import com.dk.mdm.infrastructure.convert.ivt.InboundConvert;
 import com.dk.mdm.infrastructure.convert.ivt.InboundItemConvert;
 import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.mapper.ivt.*;
+import com.dk.mdm.mapper.mst.SupplierMapper;
 import com.dk.mdm.model.pojo.ivt.Inbound;
 import com.dk.mdm.model.pojo.ivt.InboundItem;
 import com.dk.mdm.model.pojo.ivt.IntoReturn;
 import com.dk.mdm.model.pojo.ivt.IntoReturnItem;
+import com.dk.mdm.model.pojo.mst.Supplier;
 import com.dk.mdm.model.pojo.pur.Purchase;
 import com.dk.mdm.model.pojo.pur.PurchaseItem;
 import com.dk.mdm.model.query.ivt.InboundItemQuery;
@@ -82,6 +84,8 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
     @Autowired
     private AccountService accountService;
 
+    @Autowired
+    private SupplierMapper supplierMapper;
 
     /**
      * @desc : 条件查询
@@ -118,6 +122,17 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
      */
     @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<?> purchaseReturnInboundInsert(InboundVO inboundVO) {
+
+        //TODO 更新供应商信息(后续可能会 在入库表中增加地址字段) 2024/7/17 于继渤
+        if (inboundVO.getSupId() != null && inboundVO.getReturnAddress() !=null){
+            Supplier supplier = new Supplier();
+            supplier.setSupId(inboundVO.getSupId());
+            supplier.setReturnAddress(inboundVO.getReturnAddress());
+            supplierMapper.update(supplier,
+                    new UpdateWrapper<Supplier>().lambda()
+                            .eq(Supplier::getSupId, UUID.fromString(supplier.getSupId()))
+            );
+        }
         //region  查询当前公司的系统参数  自动办理信息  并赋值
         Map<String, Object> map = new HashMap<>();
         map.put("cpId", inboundVO.getCpId());
@@ -145,10 +160,7 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
             //入库中
             inboundVO.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
         }
-        //退货数量
-        inboundVO.setReturnQty(inboundVO.getIntoingQty());
-        //退货金额
-        inboundVO.setReturnAmt(inboundVO.getIntoingAmt());
+
         //入库状态等于已入库 更新合计入库数量/金额 = 入库中数量/入库中金额
         if (Constant.IntoStatus.YIRUKU.getName().equals(inboundVO.getIntoStatus())) {
             inboundVO
@@ -220,7 +232,7 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
         if (Constant.IntoStatus.YIRUKU.getName().equals(inboundVO.getIntoStatus())) {
             Map<String, Object> invMap = new HashMap<>();
             invMap.put("intoDetail", inboundVO.getItemList());
-            inventoryService.operatingInventoryInformation(map);
+            inventoryService.operatingInventoryInformation(invMap);
         }
         //endregion
 
@@ -234,6 +246,7 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
      */
     @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<?> purchaseReturnInboundUpdate(InboundVO inboundVO) {
+
         //region 小编辑
         if (!inboundVO.getLimitEdit()) {
             Inbound inbound = new Inbound();
@@ -257,6 +270,7 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
             }
         }
         //endregion
+
         //region 大编辑
         else {
             //region 根据id查询 此条入库单的数据还未更改前的数据
@@ -275,13 +289,6 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
                 List<InboundItemVO> itemList = inboundVO.getItemList();
                 for (InboundItemVO inboundItemVO : itemList) {
 
-                    //region  不能新建
-//                    if (inboundItemVO.getSPurItemId() == null) {
-//                        throw new BaseBusinessException(ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getCode(),
-//                                ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getMessage());
-//                    }
-                    //endregion
-
                     //根据id查询
                     InboundItemResponse inboundItemResponse = inboundItemMapper.selectById(inboundItemVO.getItemId());
 
@@ -464,6 +471,7 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
             //endregion
         }
         //endregion
+
         return ResponseResultUtil.success(inboundVO);
     }
 

+ 12 - 10
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java

@@ -781,8 +781,10 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                         //region  提取新建分组后的明细
                         List<InboundItemVO> purchaseIntoItemVOListGroup = purchaseIntoItemVOListMap.get(fromId);
                         //分组后的明细 出库数量和金额总和
-                        BigDecimal purchaseSumQty = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
-                        BigDecimal purchaseSumAmt = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal purchaseSumQtying = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal purchaseSumAmting = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal purchaseSumQty = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                        BigDecimal purchaseSumAmt = purchaseIntoItemVOListGroup.stream().map(InboundItemVO::getIntoAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
                         //分组后的明细 原出库数量和金额总和
                         BigDecimal updatePurchaseIntoQty = BigDecimal.ZERO;
                         BigDecimal updatePurchaseIntoAmt = BigDecimal.ZERO;
@@ -835,8 +837,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                         }
                         //入库中
                         else if (Constant.IntoStatus.RUKUZHONG.getName().equals(inboundResponse.getIntoStatus())) {
-                            purchase.setIntoingQty(purchaseSumQty.subtract(updatePurchaseIntoingQty).subtract(purchaseDelOutQty));
-                            purchase.setIntoingAmt(purchaseSumAmt.subtract(updatePurchaseIntoingAmt).subtract(purchaseDelOutAmt));
+                            purchase.setIntoingQty(purchaseSumQtying.subtract(updatePurchaseIntoingQty).subtract(purchaseDelOutQty));
+                            purchase.setIntoingAmt(purchaseSumAmting.subtract(updatePurchaseIntoingAmt).subtract(purchaseDelOutAmt));
                             purchase.setUpdateIntoingMessageFlag(true);
                             //入库状态
                             String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchase.getIntoingQty()),
@@ -1665,8 +1667,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                         //region 将库存需要的参数赋值
                         inboundItemResponse.setInventoryType(Constant.InventoryType.INBOUND.getName());
                         inboundItemResponse.setInventoryDocCode(Constant.InventoryDocCode.PURCHASE_ORDER.getValue());
-                        inboundItemResponse.setIntoQty(inboundItemResponse.getIntoQty().negate());
-                        inboundItemResponse.setIntoAmt(inboundItemResponse.getIntoAmt().negate());
+                        inboundItemResponse.setIntoQty(inboundItemResponse.getIntoQty());
+                        inboundItemResponse.setIntoAmt(inboundItemResponse.getIntoAmt());
                         //endregion
 
                         //region  编辑明细  赋值 赋值明细  防止作废的单据查不到明细 故注掉下面代码
@@ -1783,8 +1785,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
     public String setIntoStatus(BigDecimal intoingQty, BigDecimal intoQty, BigDecimal sumQty) {
         //入库状态
         String intoStatus = null;
-        //入库中小于等于总数,已入库小于总数,并且入库中+已入库大于0
-        if (intoingQty.compareTo(sumQty) <= 0 && intoQty.compareTo(sumQty) < 0 && intoingQty.add(intoQty).compareTo(BigDecimal.ZERO) > 0) {
+        //已入库数量>=0 入库中数量>0
+        if (intoQty.compareTo(BigDecimal.ZERO) >= 0 && intoingQty.compareTo(BigDecimal.ZERO) > 0) {
             //入库中
             intoStatus = Constant.IntoStatus.RUKUZHONG.getName();
         }
@@ -1793,8 +1795,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
             //待入库
             intoStatus = Constant.IntoStatus.DAIRUKU.getName();
         }
-        //入库中+已入库 等于 总数 并且 入库中数量小于等于订单总数量
-        else if (intoingQty.compareTo(sumQty) < 0 && intoingQty.add(intoQty).compareTo(sumQty) == 0) {
+        //已入库 数量>0 入库中数量=0
+        else if (intoQty.compareTo(BigDecimal.ZERO) > 0 && intoingQty.compareTo(BigDecimal.ZERO) == 0) {
             //已入库
             intoStatus = Constant.IntoStatus.YIRUKU.getName();
         }

+ 14 - 10
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -326,9 +326,11 @@ public class InventoryService extends BaseService<Inventory> {
         //入库
         if (map.get("intoDetail") != null) {
             intoDetail = (JSONArray) JSON.toJSON(map.get("intoDetail"));
-            JSONObject obj = (JSONObject) intoDetail.get(0);
-            inventoryDocCode = obj.get("inventoryDocCode").toString();
-            addOrEditFlag = obj.getBoolean("addOrEditFlag");
+            if (intoDetail.size() > 0) {
+                JSONObject obj = (JSONObject) intoDetail.get(0);
+                inventoryDocCode = obj.get("inventoryDocCode").toString();
+                addOrEditFlag = obj.getBoolean("addOrEditFlag");
+            }
         }
         //入库删除
         if (map.get("delIntoDetail") != null) {
@@ -1395,13 +1397,15 @@ public class InventoryService extends BaseService<Inventory> {
                 costAmt.divide(inventory.getInvQty(), BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
         inventoryMapper.updateAmtAndQty(inventory);
 
-        //region 采购入库 并且 其他入库编辑传给库存标识 为true 查询库存修改完是否为0,如果为0 将库存制成无效
-        if (Constant.InventoryDocCode.OTHER_INBOUND.getValue().equals(inOutRecordVO.getInventoryDocCode()) && inOutRecordVO.getUpdateOtherIntoInvFlag() != null && inOutRecordVO.getUpdateOtherIntoInvFlag()) {
-            InventoryResponse inventoryDel = inventoryMapper.selectById(inventory.getInvId());
-            if (inventoryDel.getInvQty().compareTo(BigDecimal.ZERO) == 0) {
-                inventoryMapper.updateFlgValid(new InventoryVO().setInvId(inventory.getInvId()));
-            }
-        }
+        //todo  2024年7月17日15:23:01  这里周哥在查询的地方过滤了  不用置为无效了
+        //region 其他入库 并且 编辑传给库存标识 为true 查询库存修改完是否为0,如果为0 将库存制成无效
+//        if (Constant.InventoryDocCode.OTHER_INBOUND.getValue().equals(inOutRecordVO.getInventoryDocCode())
+//                && inOutRecordVO.getUpdateOtherIntoInvFlag() != null && inOutRecordVO.getUpdateOtherIntoInvFlag()) {
+//            InventoryResponse inventoryDel = inventoryMapper.selectById(inventory.getInvId());
+//            if (inventoryDel.getInvQty().compareTo(BigDecimal.ZERO) == 0) {
+//                inventoryMapper.updateFlgValid(new InventoryVO().setInvId(inventory.getInvId()));
+//            }
+//        }
         //endregion
 
         //endregion

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

@@ -2074,7 +2074,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     public String setOutStatus(BigDecimal outingQty, BigDecimal outQty) {
         //出库状态
         String outStatus = null;
-        //已出库数量>0 出库中数量>0
+        //已出库数量>=0 出库中数量>0
         if (outQty.compareTo(BigDecimal.ZERO) >= 0 && outingQty.compareTo(BigDecimal.ZERO) > 0) {
             //出库中
             outStatus = Constant.OutStatus.CHUKUZHONG.getName();

+ 1 - 1
src/main/resources/prod/bootstrap.yml

@@ -15,7 +15,7 @@ spring:
         namespace: dkic
   datasource:
     driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://dkdev.dkiboss.com:15000/dkic_dev_b1
+    url: jdbc:postgresql://localhost:15100/dkic_pro_b1
     username: dkic_sp
     password: dk
     type: com.alibaba.druid.pool.DruidDataSource