|
@@ -4,14 +4,20 @@ import java.math.BigDecimal;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import com.ruoyi.ams.asn.form.PaForm;
|
|
|
import com.ruoyi.ams.asn.form.StockForm;
|
|
|
import com.ruoyi.ams.asn.form.StockInfoForm;
|
|
|
+import com.ruoyi.ams.asn.form.UnlockForm;
|
|
|
import com.ruoyi.ams.asn.mapper.WmsDocAsnDetailsMapper;
|
|
|
import com.ruoyi.ams.box.domain.WmsBoxInfo;
|
|
|
import com.ruoyi.ams.box.service.IWmsBoxInfoService;
|
|
|
import com.ruoyi.ams.config.domain.dto.LotattDTO;
|
|
|
+import com.ruoyi.ams.inv.domain.ActTransactionLog;
|
|
|
import com.ruoyi.ams.inv.domain.InvLotAtt;
|
|
|
import com.ruoyi.ams.inv.domain.InvLotLocId;
|
|
|
+import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
|
|
|
+import com.ruoyi.ams.inv.service.IActTransactionLogService;
|
|
|
+import com.ruoyi.ams.inv.service.IInvLotAttService;
|
|
|
import com.ruoyi.ams.inv.service.IInvLotLocIdService;
|
|
|
import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
|
|
|
import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
|
|
@@ -20,6 +26,7 @@ import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
|
|
|
import com.ruoyi.base.constant.Constant;
|
|
|
import com.ruoyi.base.domain.BaseSku;
|
|
|
import com.ruoyi.base.service.IBaseSkuService;
|
|
|
+import com.ruoyi.base.utils.IdSequenceUtils;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
@@ -56,6 +63,14 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
private IWmsDocOrderHeaderService wmsDocOrderHeaderService;
|
|
|
@Autowired
|
|
|
private IBaseSkuService baseSkuService;
|
|
|
+ @Autowired
|
|
|
+ private IWmsBoxInfoService wmsBoxInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IActTransactionLogService actTransactionLogService;
|
|
|
+ @Autowired
|
|
|
+ private IdSequenceUtils idSequenceUtils;
|
|
|
+ @Autowired
|
|
|
+ private IInvLotAttService invLotAttService;
|
|
|
|
|
|
/**
|
|
|
* 查询入库单
|
|
@@ -237,6 +252,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
} else {
|
|
|
wmsBoxInfo.setBoxState(1);
|
|
|
wmsBoxInfo.setIsFull(stockForm.getFullTag());
|
|
|
+ wmsBoxInfo.setLocationId(Long.parseLong(STAGE01));
|
|
|
boxInfoService.updateWmsBoxInfo(wmsBoxInfo);
|
|
|
}
|
|
|
|
|
@@ -258,7 +274,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
queryAtt.setSku(s.getSku());
|
|
|
queryAtt.setLotatt02(s.getSkuSn());
|
|
|
List<InvLotLocId> invList = invLotLocIdService.queryInvByInvLotatt(queryAtt, stockForm.getPalletNo());
|
|
|
- if (invList != null && invList.size() > 0) {
|
|
|
+ if (invList != null && invList.size() > 1) {
|
|
|
throw new ServiceException("每个成品条码只允许码一次");
|
|
|
}
|
|
|
|
|
@@ -270,7 +286,10 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
if (stockForm.getStockTag().equals("Y")) {
|
|
|
//如果是备货需要判断入库单
|
|
|
WmsDocOrderDetails od = orderMap.get(s.getSku());
|
|
|
- if (od.getQtyOrdered().subtract(new BigDecimal(s.getQty())).compareTo(BigDecimal.ZERO) != 1) {
|
|
|
+// if (od.getQtyOrdered().subtract(new BigDecimal(s.getQty())).compareTo(BigDecimal.ZERO) != 1) {
|
|
|
+// throw new ServiceException("备货数量超出出库单需求数量");
|
|
|
+// }
|
|
|
+ if (od.getQtyOrdered().compareTo(new BigDecimal(s.getQty()).add(od.getQtySoftAllocated())) == -1) {
|
|
|
throw new ServiceException("备货数量超出出库单需求数量");
|
|
|
}
|
|
|
//更新出库单备货数量
|
|
@@ -290,12 +309,31 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
//更新数量
|
|
|
asnDetails.setReceivedQty(asnDetails.getReceivedQty().add(new BigDecimal(s.getQty())));
|
|
|
String asnStatus = "30";
|
|
|
- if (asnDetails.getReceivedQty().add(new BigDecimal(s.getQty())).compareTo(asnDetails.getExpectedQty()) == 0) {
|
|
|
+ if (asnDetails.getReceivedQty().compareTo(asnDetails.getExpectedQty()) == 0) {
|
|
|
asnStatus = "40";
|
|
|
+ boolean isClose = true;
|
|
|
+ WmsDocAsnDetails query = new WmsDocAsnDetails();
|
|
|
+ query.setAsnNo(s.getAsnNo());
|
|
|
+ List<WmsDocAsnDetails> detailsList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(query);
|
|
|
+ if (detailsList != null && detailsList.size() > 0) {
|
|
|
+ for (WmsDocAsnDetails de : detailsList) {
|
|
|
+ if (de.getLineStatus().equals("30")) {
|
|
|
+ isClose = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WmsDocAsnHeader updateStatus = new WmsDocAsnHeader();
|
|
|
+ if (isClose) {
|
|
|
+ updateStatus.setAsnStatus("40");
|
|
|
+ } else {
|
|
|
+ updateStatus.setAsnStatus("30");
|
|
|
+ }
|
|
|
+ wmsDocAsnHeaderMapper.updateWmsDocAsnHeader(updateStatus);
|
|
|
}
|
|
|
+
|
|
|
//更新入库单数量
|
|
|
wmsDocAsnDetailsMapper.updateWmsReceivedQty(asnDetails.getAsnNo(), asnDetails.getAsnLineNo().intValue(), new BigDecimal(s.getQty()), asnStatus);
|
|
|
- if(!StringUtils.isEmpty(stockForm.getOrderNo())) {
|
|
|
+ if (!StringUtils.isEmpty(stockForm.getOrderNo())) {
|
|
|
//绑定对应入库单号
|
|
|
WmsDocAsnDetails updateDetails = new WmsDocAsnDetails();
|
|
|
updateDetails.setAsnNo(asnDetails.getAsnNo());
|
|
@@ -304,7 +342,79 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
updateDetails.setdEdi02(s.getSkuSn());//产品sn
|
|
|
wmsDocAsnDetailsMapper.updateWmsDocAsnDetails(updateDetails);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
return AjaxResult.success("操作成功");
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public AjaxResult doPa(PaForm paForm) {
|
|
|
+ //绑定托盘
|
|
|
+ String palletNo = paForm.getPalletNo();
|
|
|
+ WmsBoxInfo wmsBoxInfo = new WmsBoxInfo();
|
|
|
+ wmsBoxInfo.setBoxNo(palletNo);
|
|
|
+ wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByModel(wmsBoxInfo);
|
|
|
+ if (wmsBoxInfo == null) {
|
|
|
+ throw new ServiceException("托盘不存在");
|
|
|
+ }
|
|
|
+ wmsBoxInfo.setLocationId(Long.parseLong(paForm.getLocationTo()));
|
|
|
+ int result = wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
|
|
|
+ if (result <= 0) {
|
|
|
+ throw new ServiceException("托盘绑定更新失败");
|
|
|
+ }
|
|
|
+ //库存移动
|
|
|
+ InvLotLocIdMoveForm moveForm = new InvLotLocIdMoveForm();
|
|
|
+ moveForm.setLocationFrom(paForm.getLocationFrom());
|
|
|
+ moveForm.setLocationTo(paForm.getLocationTo());
|
|
|
+ moveForm.setIsCallCar("N");
|
|
|
+
|
|
|
+ //更新明细状态
|
|
|
+
|
|
|
+
|
|
|
+ List<InvLotLocId> invLotLocIdList = invLotLocIdService.queryInvByInvLotatt(null, palletNo);
|
|
|
+ InvLotAtt invLotAtt = null;
|
|
|
+ if (invLotLocIdList != null && invLotLocIdList.size() > 0) {
|
|
|
+ for (InvLotLocId inv : invLotLocIdList) {
|
|
|
+ invLotAtt = invLotAttService.selectInvLotAttByLotnum(inv.getLotnum());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String lotatt08 = invLotAtt.getLotatt08();
|
|
|
+ WmsDocAsnDetails query = new WmsDocAsnDetails();
|
|
|
+ query.setAsnNo(lotatt08);
|
|
|
+ List<WmsDocAsnDetails> detailsList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(query);
|
|
|
+ if (detailsList != null && detailsList.size() > 0) {
|
|
|
+ for (WmsDocAsnDetails de : detailsList) {
|
|
|
+ de.setLineStatus("60");
|
|
|
+ wmsDocAsnDetailsMapper.updateWmsDocAsnDetails(de);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WmsDocAsnHeader updateStatus = new WmsDocAsnHeader();
|
|
|
+ updateStatus.setAsnStatus("60");
|
|
|
+ wmsDocAsnHeaderMapper.updateWmsDocAsnHeader(updateStatus);
|
|
|
+
|
|
|
+ //TODO 修改上架数量
|
|
|
+ //TODO 事务日志
|
|
|
+ String tracNo = idSequenceUtils.generateId("TRANSACTIONID");
|
|
|
+ ActTransactionLog paLog = new ActTransactionLog();
|
|
|
+ paLog.setTransactionId(tracNo);
|
|
|
+ paLog.setTransactionType(Constant.Transaction_TYPE.PA.getValue());
|
|
|
+ //paLog.setDocNo();
|
|
|
+ actTransactionLogService.insertActTransactionLog(paLog);
|
|
|
+ return invLotLocIdService.move(moveForm);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult unloadStock(UnlockForm unlockForm) {
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int closeHeader(String asnNo, Long asnLineNo) {
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|