|
|
@@ -0,0 +1,419 @@
|
|
|
+package com.dk.mdm.service.ivt;
|
|
|
+
|
|
|
+import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
+import com.dk.common.infrastructure.constant.Constant;
|
|
|
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
|
|
|
+import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.common.model.pojo.PageList;
|
|
|
+import com.dk.common.response.ResponseResultUtil;
|
|
|
+import com.dk.common.response.ResponseResultVO;
|
|
|
+import com.dk.common.service.BaseService;
|
|
|
+import com.dk.mdm.infrastructure.convert.ivt.InboundConvert;
|
|
|
+import com.dk.mdm.infrastructure.convert.ivt.InboundItemConvert;
|
|
|
+import com.dk.mdm.mapper.ivt.InboundItemMapper;
|
|
|
+import com.dk.mdm.mapper.ivt.InboundMapper;
|
|
|
+import com.dk.mdm.mapper.pur.PurchaseItemMapper;
|
|
|
+import com.dk.mdm.mapper.pur.PurchaseMapper;
|
|
|
+import com.dk.mdm.model.pojo.ivt.Inbound;
|
|
|
+import com.dk.mdm.model.pojo.ivt.InboundItem;
|
|
|
+import com.dk.mdm.model.pojo.pur.Purchase;
|
|
|
+import com.dk.mdm.model.pojo.pur.PurchaseItem;
|
|
|
+import com.dk.mdm.model.query.ivt.InboundItemQuery;
|
|
|
+import com.dk.mdm.model.query.ivt.InboundQuery;
|
|
|
+import com.dk.mdm.model.query.pur.PurchaseItemQuery;
|
|
|
+import com.dk.mdm.model.response.ivt.InboundItemResponse;
|
|
|
+import com.dk.mdm.model.response.ivt.InboundResponse;
|
|
|
+import com.dk.mdm.model.response.pur.PurchaseItemResponse;
|
|
|
+import com.dk.mdm.model.response.pur.PurchaseResponse;
|
|
|
+import com.dk.mdm.model.vo.ivt.InboundItemVO;
|
|
|
+import com.dk.mdm.model.vo.ivt.InboundVO;
|
|
|
+import com.dk.mdm.service.common.CommonService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @desc : 销售退货入库业务层
|
|
|
+ * @date : 2024/3/7 14:11
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Transactional
|
|
|
+public class InboundSaleReturnService extends BaseService<Inbound> {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public BaseMapper<Inbound> getRepository() {
|
|
|
+ return inboundMapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InboundMapper inboundMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InboundConvert inboundConvert;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InboundItemMapper inboundItemMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InboundItemConvert inboundItemConvert;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseMapper purchaseMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseItemMapper purchaseItemMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 条件查询
|
|
|
+ * @date : 2024/3/7 14:12
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ @Pagination
|
|
|
+ public ResponseResultVO<PageList<InboundResponse>> selectInboundAndItem(InboundQuery inboundQuery) {
|
|
|
+ return super.mergeListWithCount(inboundQuery, inboundMapper.selectInboundAndItem(inboundQuery),
|
|
|
+ inboundMapper.selectInboundAndItemCountByCond(inboundQuery));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 销售退货入库新建
|
|
|
+ * @date : 2024/3/7 14:13
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
+ public ResponseResultVO<?> saleReturnInboundInsert(InboundVO inboundVO) {
|
|
|
+ //region 总单
|
|
|
+ //获取 id/单号
|
|
|
+ Map<String , Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OTHERINBOUND.getName(),false);
|
|
|
+ inboundVO.setIntoId(codeMap.get("outId").toString()).
|
|
|
+ setIntoNo(codeMap.get("outNote").toString());
|
|
|
+ //入库类型
|
|
|
+ inboundVO.setIntoType(Constant.IntoType.PURRETURN.getName());
|
|
|
+ //入库状态 待入库
|
|
|
+ inboundVO.setIntoStatus(Constant.IntoStatus.DAIRUKU.getName());
|
|
|
+ //退货数量
|
|
|
+ inboundVO.setReturnQty(inboundVO.getIntoingQty());
|
|
|
+ //退货金额
|
|
|
+ inboundVO.setReturnAmt(inboundVO.getIntoingAmt());
|
|
|
+ //实体转换
|
|
|
+ Inbound inbound = inboundConvert.convertToPo(inboundVO);
|
|
|
+ inboundMapper.insert(inbound);
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 明细
|
|
|
+ //校验明细
|
|
|
+ if (inboundVO.getItemList().size() == 0) {
|
|
|
+ return ResponseResultUtil.error(ErrorCodeEnum.INBOUND_ITEM_NOT_EXIST.getCode(),
|
|
|
+ ErrorCodeEnum.INBOUND_ITEM_NOT_EXIST.getMessage());
|
|
|
+ }
|
|
|
+ for (InboundItemVO inboundItemVO : inboundVO.getItemList()) {
|
|
|
+ Map<String , Object> map = commonService.getUniqueNoteCode(Constant.docNameConstant.OTHERINBOUNDITEM.getName(),true);
|
|
|
+ //明细id
|
|
|
+ inboundItemVO.setItemId(map.get("outId").toString());
|
|
|
+ //总单id
|
|
|
+ inboundItemVO.setIntoId(inboundVO.getIntoId());
|
|
|
+ //入库类型
|
|
|
+ inboundItemVO.setIntoType(inboundVO.getIntoType());
|
|
|
+ //入库状态等于已入库 更新合计入库数量/金额 = 入库中数量/入库中金额
|
|
|
+ if (Constant.IntoStatus.YIRUKU.getName().equals(inboundVO.getIntoStatus())) {
|
|
|
+ inboundItemVO.setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
+ .setIntoAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ }
|
|
|
+ //成本单价
|
|
|
+ inboundItemVO.setCostPrice(inboundItemVO.getCostPrice());
|
|
|
+ //成本金额
|
|
|
+ inboundItemVO.setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ //库存数量 已入库-出库
|
|
|
+ inboundItemVO.setInvQty(inboundItemVO.getIntoQty().subtract(inboundItemVO.getOutQty()));
|
|
|
+ //入库状态
|
|
|
+ inboundItemVO.setIntoStatus(inboundVO.getIntoStatus());
|
|
|
+ //退货数量
|
|
|
+ inboundItemVO.setReturnQty(inboundItemVO.getIntoingQty());
|
|
|
+ //退货金额
|
|
|
+ inboundItemVO.setReturnAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItemMapper.insert(inboundItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //todo 如果是已入库 调用库存 后续写库存这里补上
|
|
|
+ //region 库存
|
|
|
+
|
|
|
+
|
|
|
+ //endregion
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseResultUtil.success(inboundVO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 销售退货入库办理
|
|
|
+ * @date : 2024/3/7 15:47
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
+ public ResponseResultVO<?> saleReturnHandleInbound(InboundVO inboundVO) {
|
|
|
+ //大编辑标识
|
|
|
+ if (inboundVO.getAllEdit() != null && inboundVO.getAllEdit()) {
|
|
|
+ //region 编辑明细
|
|
|
+ //校验明细
|
|
|
+ if (inboundVO.getItemList().size() == 0) {
|
|
|
+ return ResponseResultUtil.error(ErrorCodeEnum.INBOUND_ITEM_NOT_EXIST.getCode(),
|
|
|
+ ErrorCodeEnum.INBOUND_ITEM_NOT_EXIST.getMessage());
|
|
|
+ }
|
|
|
+ for (InboundItemVO inboundItemVO : inboundVO.getItemList()) {
|
|
|
+ if (inboundItemVO.getIntoId() != null) {
|
|
|
+ //编辑明细
|
|
|
+ inboundItemVO.setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ .setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
+ .setIntoAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
+ inboundItemVO.setIntoStatus(intoStatus);
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.updateById(inboundItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ //region 新建明细
|
|
|
+ else {
|
|
|
+ Map<String , Object> map = commonService.getUniqueNoteCode(Constant.docNameConstant.OTHERINBOUNDITEM.getName(),true);
|
|
|
+ inboundItemVO
|
|
|
+ .setItemId(map.get("outId").toString())
|
|
|
+ .setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
+ .setIntoAmt(inboundItemVO.getIntoingAmt())
|
|
|
+ .setIntoId(inboundVO.getIntoId())
|
|
|
+ .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ .setIntoType(Constant.IntoType.PURRETURN.getName());
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
+ inboundItemVO.setIntoStatus(intoStatus);
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ //新建
|
|
|
+ inboundItemMapper.insert(inboundItem);
|
|
|
+ }
|
|
|
+ //region 销售退货
|
|
|
+ //销售退货明细
|
|
|
+ if(inboundItemVO.getFromItemId()!=null){
|
|
|
+ PurchaseItemResponse purchaseItemResponse = purchaseItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
+ PurchaseItem purchaseItem = new PurchaseItem();
|
|
|
+ purchaseItem.setItemId(purchaseItemResponse.getItemId());
|
|
|
+ purchaseItem.setIntoingQty(purchaseItemResponse.getIntoingQty().subtract(inboundItemVO.getIntoQty()));
|
|
|
+ purchaseItem.setIntoingAmt(purchaseItemResponse.getIntoingAmt().subtract(inboundItemVO.getIntoAmt()));
|
|
|
+ purchaseItem.setIntoQty(purchaseItemResponse.getIntoQty().add(inboundItemVO.getIntoQty()));
|
|
|
+ purchaseItem.setIntoAmt(purchaseItemResponse.getIntoAmt().add(inboundItemVO.getIntoAmt()));
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(purchaseItem.getIntoingQty(), purchaseItem.getIntoQty());
|
|
|
+ purchaseItem.setIntoStatus(intoStatus);
|
|
|
+ purchaseItemMapper.updateById(purchaseItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 删除明细
|
|
|
+ BigDecimal sumDelIntoQty = BigDecimal.ZERO;
|
|
|
+ BigDecimal sumDelIntoAmt = BigDecimal.ZERO;
|
|
|
+ if (inboundVO.getDeleteItemList() != null) {
|
|
|
+ sumDelIntoQty = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sumDelIntoAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ for (InboundItemVO inboundItemVO : inboundVO.getDeleteItemList()) {
|
|
|
+ if (inboundItemVO.getItemId() != null) {
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItem.setFlgValid(false);
|
|
|
+ inboundItemMapper.updateById(inboundItem);
|
|
|
+ }
|
|
|
+ //region 销售退货
|
|
|
+ if(inboundVO.getFromId()!=null){
|
|
|
+ //region 销售退货订单明细
|
|
|
+ List<PurchaseItemResponse> purchaseItemResponses = purchaseItemMapper.selectByCond(new PurchaseItemQuery().setPurId(inboundVO.getFromId()));
|
|
|
+ for (PurchaseItemResponse purchaseItemResponse : purchaseItemResponses) {
|
|
|
+ PurchaseItem purchaseItem = new PurchaseItem();
|
|
|
+ purchaseItem.setItemId(purchaseItemResponse.getItemId());
|
|
|
+ purchaseItem.setIntoingQty(purchaseItemResponse.getIntoingQty().add(purchaseItemResponse.getIntoQty()));
|
|
|
+ purchaseItem.setIntoingAmt(purchaseItemResponse.getIntoingAmt().add(purchaseItemResponse.getIntoAmt()));
|
|
|
+ purchaseItem.setIntoQty(BigDecimal.ZERO);
|
|
|
+ purchaseItem.setIntoingAmt(BigDecimal.ZERO);
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(purchaseItem.getIntoingQty(), purchaseItem.getIntoQty());
|
|
|
+ purchaseItem.setIntoStatus(intoStatus);
|
|
|
+ purchaseItemMapper.updateById(purchaseItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 编辑总单
|
|
|
+ BigDecimal sumIntoQty = inboundVO.getItemList().stream().map(InboundItemVO::getIntoQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal sumIntoAmt = inboundVO.getItemList().stream().map(InboundItemVO::getIntoAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ inboundVO.setIntoQty(sumIntoQty);
|
|
|
+ inboundVO.setIntoAmt(sumIntoAmt);
|
|
|
+ //已入库数量==入库中数量 入库完成
|
|
|
+ if(sumIntoQty.compareTo(inboundVO.getIntoQty())==0){
|
|
|
+ //已入库
|
|
|
+ inboundVO.setIntoStatus(Constant.IntoStatus.YIRUKU.getName());
|
|
|
+ } else {
|
|
|
+ //入库中
|
|
|
+ inboundVO.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
|
|
|
+ }
|
|
|
+ //实体转换
|
|
|
+ Inbound inbound = inboundConvert.convertToPo(inboundVO);
|
|
|
+ //修改
|
|
|
+ super.update(inbound);
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 修改销售退货订单
|
|
|
+ if(inboundVO.getFromId()!=null){
|
|
|
+ PurchaseResponse purchaseResponse = purchaseMapper.selectById(inboundVO.getFromId());
|
|
|
+ Purchase purchase = new Purchase();
|
|
|
+ purchase.setPurId(purchaseResponse.getPurId());
|
|
|
+ purchase.setIntoQty(purchaseResponse.getIntoQty().subtract(sumIntoQty.add(sumDelIntoQty)));
|
|
|
+ purchase.setIntoAmt(purchaseResponse.getIntoAmt().subtract(sumIntoAmt.add(sumDelIntoAmt)));
|
|
|
+ purchase.setIntoingQty(purchaseResponse.getIntoingQty().add(sumIntoQty).subtract(sumDelIntoQty));
|
|
|
+ purchase.setIntoingAmt(purchaseResponse.getIntoingAmt().add(sumIntoAmt).subtract(sumDelIntoAmt));
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(purchase.getIntoingQty(), purchase.getIntoQty());
|
|
|
+ purchase.setIntoStatus(intoStatus);
|
|
|
+ //修改
|
|
|
+ purchaseMapper.updateById(purchase);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //todo 如果是已入库 调用库存 后续写库存这里补上
|
|
|
+ //region 修改库存
|
|
|
+
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ return ResponseResultUtil.success(inboundVO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 销售退货入库撤销
|
|
|
+ * @date : 2024/3/7 17:06
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
+ public ResponseResultVO<?> saleReturnInboundCancel(InboundVO inboundVO) {
|
|
|
+ //region 查询入库总单数据信息
|
|
|
+ InboundResponse inboundResponse = inboundMapper.selectById(inboundVO.getIntoId());
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 修改订单数据信息
|
|
|
+ if (inboundVO.getFromId() != null) {
|
|
|
+ PurchaseResponse purchaseResponse = purchaseMapper.selectById(inboundResponse.getFromId());
|
|
|
+ Purchase purchase = new Purchase();
|
|
|
+ purchase.setPurId(inboundResponse.getFromId());
|
|
|
+ purchase.setIntoQty(purchaseResponse.getIntoQty().subtract(inboundResponse.getIntoQty()));
|
|
|
+ purchase.setIntoAmt(purchaseResponse.getIntoAmt().subtract(inboundResponse.getIntoAmt()));
|
|
|
+ purchase.setIntoingQty(purchaseResponse.getIntoingQty().add(inboundResponse.getIntoQty()));
|
|
|
+ purchase.setIntoingAmt(purchaseResponse.getIntoingAmt().add(inboundResponse.getIntoAmt()));
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(purchase.getIntoingQty(), purchase.getIntoQty());
|
|
|
+ purchase.setIntoStatus(intoStatus);
|
|
|
+ purchaseMapper.updateById(purchase);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 修改总单数据信息
|
|
|
+ Inbound inbound = new Inbound();
|
|
|
+ inbound.setIntoId(inboundVO.getIntoId());
|
|
|
+ inbound.setIntoDate(null);
|
|
|
+ inbound.setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName());
|
|
|
+ inbound.setIntoQty(BigDecimal.ZERO);
|
|
|
+ inbound.setIntoAmt(BigDecimal.ZERO);
|
|
|
+ inboundMapper.updateById(inbound);
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 明细数据
|
|
|
+ //根据总单id查明细
|
|
|
+ List<InboundItemResponse> orderEntryItemResponsesList = inboundItemMapper.selectByCond(new InboundItemQuery().setIntoId(inbound.getIntoId()));
|
|
|
+ for (InboundItemResponse inboundItemResponse : orderEntryItemResponsesList) {
|
|
|
+ //region 修改销售退货明细数据信息
|
|
|
+ if(inboundItemResponse.getFromItemId()!=null){
|
|
|
+ //查询
|
|
|
+ PurchaseItemResponse purchaseItemResponse = purchaseItemMapper.selectById(inboundItemResponse.getFromItemId());
|
|
|
+ PurchaseItem purchaseItem = new PurchaseItem();
|
|
|
+ purchaseItem.setItemId(purchaseItemResponse.getItemId());
|
|
|
+ purchaseItem.setIntoQty(purchaseItemResponse.getIntoQty().subtract(inboundItemResponse.getIntoQty()));
|
|
|
+ purchaseItem.setIntoAmt(purchaseItemResponse.getIntoAmt().subtract(inboundItemResponse.getIntoAmt()));
|
|
|
+ purchaseItem.setIntoingQty(purchaseItemResponse.getIntoingQty().add(inboundItemResponse.getIntoQty()));
|
|
|
+ purchaseItem.setIntoingAmt(purchaseItemResponse.getIntoingAmt().add(inboundItemResponse.getIntoAmt()));
|
|
|
+ //入库状态
|
|
|
+ String intoStatusItem = this.setIntoStatus(purchaseItem.getIntoingQty(), purchaseItem.getIntoQty());
|
|
|
+ purchaseItem.setIntoStatus(intoStatusItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region修改入库明细信息
|
|
|
+ InboundItem inboundItem = new InboundItem();
|
|
|
+ inboundItem.setIntoId(inbound.getIntoId())
|
|
|
+ .setIntoStatus(Constant.IntoStatus.RUKUZHONG.getName())
|
|
|
+ .setIntoQty(BigDecimal.ZERO)
|
|
|
+ .setIntoAmt(BigDecimal.ZERO)
|
|
|
+ .setItemId(inboundItemResponse.getItemId());
|
|
|
+ inboundItemMapper.updateById(inboundItem);
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+
|
|
|
+ //todo 调用库存 后续写库存这里补上
|
|
|
+ //region 修改库存
|
|
|
+
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 入库状态通用(目前本页面)
|
|
|
+ * @date : 2024/3/9 8:59
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ public String setIntoStatus(BigDecimal intoingQty, BigDecimal intoQty) {
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = null;
|
|
|
+ //已入库数量=0 入库中数量>0
|
|
|
+ if (intoQty.compareTo(BigDecimal.ZERO) == 0 && intoingQty.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ //入库中
|
|
|
+ intoStatus = Constant.IntoStatus.RUKUZHONG.getName();
|
|
|
+ }
|
|
|
+ //已入库数量=0 入库中数量=0
|
|
|
+ else if (intoQty.compareTo(BigDecimal.ZERO) == 0 && intoingQty.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ //待入库
|
|
|
+ intoStatus = Constant.IntoStatus.DAIRUKU.getName();
|
|
|
+ }
|
|
|
+ //已入库数量>0 入库中数量>0
|
|
|
+ else if (intoQty.compareTo(BigDecimal.ZERO) > 0 && intoingQty.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ //入库中
|
|
|
+ intoStatus = Constant.IntoStatus.RUKUZHONG.getName();
|
|
|
+ }
|
|
|
+ return intoStatus;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|