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

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

于继渤 1 год назад
Родитель
Сommit
9667fdca60

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

@@ -196,7 +196,7 @@
                 AND tpii.from_id = #{fromId}::uuid
             </if>
             <if test="fromItemId != null and fromItemId != ''">
-                AND tpii.from_item_id = #{fromItemId}
+                AND tpii.from_item_id = #{fromItemId}::uuid
             </if>
             <if test="itemIndex != null">
                 AND tpii.item_index = #{itemIndex}

+ 2 - 1
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java

@@ -475,6 +475,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                         InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
                         inboundItemMapper.insert(inboundItem);
                         inboundItemVO.setItemId(inboundItem.getItemId());
+
                         //region 将库存需要的参数赋值
                         inboundItemVO.setInventoryType(Constant.InventoryType.INBOUND.getName());
                         inboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.PURCHASE_ORDER.getValue());
@@ -854,7 +855,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                     purchase.setIntoAmt(purchaseSumAmt.subtract(updatePurchaseIntoAmt));
                     purchase.setUpdateIntoMessageFlag(true);
                     //入库状态
-                    String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchase.getIntoingQty()),
+                    String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty(),
                             purchaseResponse.getIntoQty().add(purchase.getIntoQty()), purchaseResponse.getSumQuantity());
                     purchase.setIntoStatus(intoStatus);
                 }

+ 8 - 0
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java

@@ -41,10 +41,12 @@ import com.dk.mdm.model.vo.ivt.OutboundItemVO;
 import com.dk.mdm.model.vo.ivt.OutboundVO;
 import com.dk.mdm.model.vo.mac.RecPayItemVO;
 import com.dk.mdm.model.vo.mac.RecPayVO;
+import com.dk.mdm.model.vo.mst.CustomerVO;
 import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.ivt.inventory.InventoryService;
 import com.dk.mdm.service.mac.AccountService;
 import com.dk.mdm.service.mac.ReceiptService;
+import com.dk.mdm.service.mst.CustomerService;
 import com.dk.mdm.service.mst.MoneyAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -112,6 +114,9 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
     @Autowired
     private InboundItemMapper inboundItemMapper;
 
+    @Autowired
+    private CustomerService customerService;
+
     /**
      * @desc : 修改原总单数据(订单,出库单)
      * posNegFlag :正负标识  true:正数,false:负数
@@ -434,6 +439,9 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
         if (outboundVO.getCusId() == null) {
             outboundVO = outCommon.insertCustomer(outboundVO);
         }
+        //更新总单客户状态为成交
+        customerService.update(new CustomerVO().setCusId(outboundVO.getCusId()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()) );
+
         //endregion
 
         //region  查询当前公司的系统参数  自动办理信息  并赋值

+ 4 - 4
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -189,10 +189,10 @@ public class AccountService extends BaseService<Account> {
         // 可退金额 = 总收款额-应收应款额+优惠金额
         BigDecimal sumReceiptResidue = sumAmtRec.subtract(accountForUpdate.getReceivableHandle()).add(accountForUpdate.getReceivableWaive());
 
-        // 如果可退金额小于0 ,则提示余额不足
-        if (sumReceiptResidue.compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
-        }
+        // 如果可退金额小于0 ,则提示余额不足 TODO标准版先注掉,专业版再说
+//        if (sumReceiptResidue.compareTo(BigDecimal.ZERO) == -1) {
+//            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+//        }
 
         // 更新账款总表上的收款总额和可用金额
         Account accountUpdate = new Account();

+ 27 - 17
src/main/java/com/dk/mdm/service/pur/PurchaseService.java

@@ -408,11 +408,32 @@ public class PurchaseService extends BaseService<Purchase> {
                 //存在明细
                 if(inboundResponseList!=null && inboundResponseList.size()>0){
 
+
+                    //region 总单
+                    InboundVO inboundVO = inboundConvert.convertPurchaseVOToInboundVO(purchasevo);
+                    //id
+                    inboundVO.setIntoId(inboundResponse.getIntoId());
+                    //单号
+                    inboundVO.setIntoNo(inboundResponse.getIntoNo());
+                    //入库状态
+                    inboundVO.setIntoStatus(inboundResponse.getIntoStatus());
+                    //入库中数量
+                    inboundVO.setIntoingQty(purchasevo.getSumQuantity());
+                    //已入库数量
+                    inboundVO.setIntoingAmt(purchasevo.getSumAmount());
+                    //来源id
+                    inboundVO.setFromId(purchasevo.getPurId());
+                    //来源单号
+                    inboundVO.setFromNo(purchasevo.getPurNo());
+                    //大编辑标识
+                    inboundVO.setLimitEdit(true);
+                    //endregion
+
                     //region 编辑的明细
                     if(purchasevo.getEditPurchaseItemList() !=null && purchasevo.getEditPurchaseItemList() .size()>0){
                         for (PurchaseItemVO purchaseItemVO : purchasevo.getEditPurchaseItemList()) {
                             //region 根据订单明细id查询入库单明细id  注意:虽然查出来是list但实际上只会有1条
-                            List<InboundItemResponse> inboundItemResponses = inboundItemMapper.selectByCond(new InboundItemQuery().setSPurItemId(purchaseItemVO.getPurId()));
+                            List<InboundItemResponse> inboundItemResponses = inboundItemMapper.selectByCond(new InboundItemQuery().setFromItemId(purchaseItemVO.getItemId()));
                             //endregion
 
                             //region 采购订单明细转换采购入库明细
@@ -422,6 +443,8 @@ public class PurchaseService extends BaseService<Purchase> {
                             //region 赋值 采购订单明细和入库单明细不一致的字段要单独set
                             //id制空,这里的id经过转换以后是采购订单明细的id
                             inboundItemVO.setItemId(inboundItemResponses.get(0).getItemId());
+                            //总单id
+                            inboundItemVO.setIntoId(inboundResponse.getIntoId());
                             //来源id
                             inboundItemVO.setFromId(purchasevo.getPurId());
                             //来源明细id
@@ -484,6 +507,8 @@ public class PurchaseService extends BaseService<Purchase> {
                             //region 赋值 采购订单明细和入库单明细不一致的字段要单独set
                             //id制空,这里的id经过转换以后是采购订单明细的id
                             inboundItemVO.setItemId(null);
+                            //总单id
+                            inboundItemVO.setIntoId(inboundResponse.getIntoId());
                             //来源id
                             inboundItemVO.setFromId(purchasevo.getPurId());
                             //来源明细id
@@ -519,24 +544,9 @@ public class PurchaseService extends BaseService<Purchase> {
                     }
                     //endregion
 
-                    //region 总单
-                    InboundVO inboundVO = inboundConvert.convertPurchaseVOToInboundVO(purchasevo);
-                    //id
-                    inboundVO.setIntoId(inboundResponse.getIntoId());
-                    //单号
-                    inboundVO.setIntoNo(inboundResponse.getIntoNo());
-                    //入库状态
-                    inboundVO.setIntoStatus(inboundResponse.getIntoStatus());
-                    //入库中数量
-                    inboundVO.setIntoingQty(purchasevo.getSumQuantity());
-                    //已入库数量
-                    inboundVO.setIntoingAmt(purchasevo.getSumAmount());
+                    //region 赋值明细
                     inboundVO.setItemList(itemList);
                     inboundVO.setDeleteItemList(delItemList);
-                    //来源id
-                    inboundVO.setFromId(purchasevo.getPurId());
-                    //来源单号
-                    inboundVO.setFromNo(purchasevo.getPurNo());
                     //endregion
 
                     //编辑采购入库单