|
@@ -36,6 +36,7 @@ import com.ruoyi.base.constant.Constant;
|
|
|
import com.ruoyi.base.domain.BaseLocationInfo;
|
|
|
import com.ruoyi.base.domain.BaseSku;
|
|
|
import com.ruoyi.base.domain.vo.CodeSkuRelationshipVO;
|
|
|
+import com.ruoyi.base.form.SnCheckForm;
|
|
|
import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
|
import com.ruoyi.base.service.IBaseSkuService;
|
|
|
import com.ruoyi.base.service.ICodeSkuRelationshipService;
|
|
@@ -148,6 +149,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
public int insertWmsDocAsnHeader(WmsDocAsnHeader wmsDocAsnHeader) {
|
|
|
String asnNo = idSequenceUtils.generateId("ASNNO");
|
|
|
wmsDocAsnHeader.setAsnNo(asnNo);
|
|
|
+ wmsDocAsnHeader.setEdiSendFlag("N");
|
|
|
int rows = wmsDocAsnHeaderMapper.insertWmsDocAsnHeader(wmsDocAsnHeader);
|
|
|
//insertWmsDocAsnDetails(wmsDocAsnHeader);
|
|
|
return rows;
|
|
@@ -289,7 +291,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
if (wmsBoxInfo.getIsFull() != null && wmsBoxInfo.getIsFull().equals("Y")) {
|
|
|
throw new ServiceException("该托盘已放满");
|
|
|
}
|
|
|
- wmsBoxInfo.setBoxState(1);
|
|
|
+ wmsBoxInfo.setBoxState(1);//启用状态
|
|
|
wmsBoxInfo.setIsFull(stockForm.getFullTag());
|
|
|
wmsBoxInfo.setLocationId(Long.parseLong(STAGE01));
|
|
|
wmsBoxInfo.setUpdateBy(loginUser.getUsername());
|
|
@@ -301,7 +303,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
|
|
|
//判断成品条码
|
|
|
CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(stockForm.getSkuSn());
|
|
|
-
|
|
|
+ //当前订单总数
|
|
|
BigDecimal totalQty = new BigDecimal(stockForm.getQty());
|
|
|
|
|
|
//产品条码属于出入库单
|
|
@@ -317,13 +319,14 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
if (wmsDocOrderHeader.getOrderStatus().equals("90") || wmsDocOrderHeader.getOrderStatus().equals("98") || wmsDocOrderHeader.getOrderStatus().equals("99")) {
|
|
|
return AjaxResult.error("出库单已完成");
|
|
|
}
|
|
|
- //TODO 每个托盘只允许码一个出库单
|
|
|
- /*InvLotAtt queryAtt = new InvLotAtt();
|
|
|
+ //每个托盘只允许码一个出库单
|
|
|
+ InvLotAtt queryAtt = new InvLotAtt();
|
|
|
queryAtt.setLotatt14(stockForm.getOrderNo());
|
|
|
- List<InvLotLocId> invList = invLotLocIdService.queryInvByInvLotatt(queryAtt, stockForm.getPalletNo());
|
|
|
+ queryAtt.setLotatt07(stockForm.getPalletNo());
|
|
|
+ List<InvLotLocId> invList = invLotLocIdService.queryInvByInvLotatt(queryAtt);
|
|
|
if (invList != null && invList.size() > 1) {
|
|
|
- throw new ServiceException("");
|
|
|
- }*/
|
|
|
+ throw new ServiceException("每个托盘只允许码一个出库单");
|
|
|
+ }
|
|
|
|
|
|
orderDetails = wmsDocOrderHeader.getWmsDocOrderDetailsList();
|
|
|
|
|
@@ -367,14 +370,6 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
if (codeSkuRelationshipVO.isProduct()) {
|
|
|
stockForm.setQty(BigDecimal.ONE.toString());
|
|
|
totalQty = BigDecimal.ONE;
|
|
|
-
|
|
|
- InvLotAtt queryAtt = new InvLotAtt();
|
|
|
- queryAtt.setSku(codeSkuRelationshipVO.getSku());
|
|
|
- queryAtt.setLotatt02(stockForm.getSkuSn());
|
|
|
- List<InvLotLocId> invList = invLotLocIdService.queryInvByInvLotatt(queryAtt, stockForm.getPalletNo());
|
|
|
- if (invList != null && invList.size() > 0) {
|
|
|
- throw new ServiceException("每个成品条码只允许码一次");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
//匹配对应的入库单,出库单
|
|
@@ -384,12 +379,17 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
return AjaxResult.error("没有可以接收的入库单");
|
|
|
} else {
|
|
|
for (WmsDocAsnDetails details : list) {
|
|
|
- if (new BigDecimal(stockForm.getQty()).compareTo(details.getExpectedQty()) == 1) {
|
|
|
- throw new ServiceException("入库数量超出入库单数量");
|
|
|
- }
|
|
|
- if (details.getReceivedQty().add(new BigDecimal(stockForm.getQty())).compareTo(details.getExpectedQty()) == 1) {
|
|
|
- throw new ServiceException("入库数量超出入库单数量");
|
|
|
+ InvLotAtt attQuery = new InvLotAtt();
|
|
|
+ attQuery.setSku(codeSkuRelationshipVO.getSku());
|
|
|
+ attQuery.setLotatt07(stockForm.getPalletNo());
|
|
|
+ attQuery.setLotatt02(codeSkuRelationshipVO.getSn());
|
|
|
+ attQuery.setLotatt08(details.getAsnNo());
|
|
|
+ attQuery.setLotatt14(stockForm.getOrderNo());
|
|
|
+ List<InvLotLocId> samePalletInvList = invLotLocIdMapper.queryInvByInvLotatt(attQuery);
|
|
|
+ if (samePalletInvList != null && samePalletInvList.size() > 0) {
|
|
|
+ throw new ServiceException("每个成品条码相同托盘只允许码一次");
|
|
|
}
|
|
|
+
|
|
|
//如果入库单预计数量大于接收数
|
|
|
if (details.getExpectedQty().compareTo(details.getReceivedQty()) == 1) {
|
|
|
//当前入库单可以接收的数量
|
|
@@ -412,7 +412,12 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
asnStatus = "40";
|
|
|
}
|
|
|
//更新入库单接收数量及状态
|
|
|
- wmsDocAsnDetailsMapper.updateWmsReceivedQty(details.getAsnNo(), details.getAsnLineNo().intValue(), current, asnStatus);
|
|
|
+ int result = wmsDocAsnDetailsMapper.updateWmsReceivedQty(details.getAsnNo(), details.getAsnLineNo().intValue(), current, asnStatus);
|
|
|
+ if (result > 0) {
|
|
|
+ totalQty = totalQty.subtract(current);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("更新接收数失败");
|
|
|
+ }
|
|
|
if (!StringUtils.isEmpty(stockForm.getOrderNo())) {
|
|
|
//绑定对应入库单号
|
|
|
WmsDocAsnDetails updateDetails = new WmsDocAsnDetails();
|
|
@@ -428,7 +433,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
detailsQuery.setAsnNo(details.getAsnNo());
|
|
|
List<WmsDocAsnDetails> detailsCheckList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(detailsQuery);
|
|
|
for (WmsDocAsnDetails d : detailsCheckList) {
|
|
|
- if(!d.getLineStatus().equals("40")) {
|
|
|
+ if (!d.getLineStatus().equals("40")) {
|
|
|
asnStatus = "30";
|
|
|
}
|
|
|
}
|
|
@@ -441,7 +446,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
|
|
|
//生成库存
|
|
|
LotattDTO lotattDTO = new LotattDTO();
|
|
|
- if(codeSkuRelationshipVO.isProduct()) {
|
|
|
+ if (codeSkuRelationshipVO.isProduct()) {
|
|
|
lotattDTO.setLotatt02(stockForm.getSkuSn());
|
|
|
}
|
|
|
lotattDTO.setLotatt05("90");
|
|
@@ -479,7 +484,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
}
|
|
|
|
|
|
//获取库存当前的托盘位置
|
|
|
- List<InvLotLocId> invLotLocIdList = invLotLocIdService.queryInvByInvLotatt(null, palletNo);
|
|
|
+ InvLotAtt lotAtt = new InvLotAtt();
|
|
|
+ lotAtt.setLotatt07(paForm.getPalletNo());
|
|
|
+ List<InvLotLocId> invLotLocIdList = invLotLocIdService.queryInvByInvLotatt(lotAtt);
|
|
|
for (InvLotLocId inv : invLotLocIdList) {
|
|
|
InvLotAtt invLotAtt = invLotAttService.selectInvLotAttByLotnum(inv.getLotnum());
|
|
|
invLotAtt.setLotatt12("Y");
|
|
@@ -540,8 +547,8 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SearchStockVO> searchStock(String palletNo) {
|
|
|
- return wmsDocAsnHeaderMapper.searchStock(palletNo);
|
|
|
+ public List<SearchStockVO> searchStock(String palletNo, String sku) {
|
|
|
+ return wmsDocAsnHeaderMapper.searchStock(palletNo, sku);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -554,6 +561,11 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
if (wmsBoxInfo.getLocationId() == null) {
|
|
|
return AjaxResult.error("托盘未绑定");
|
|
|
}
|
|
|
+
|
|
|
+ //把托盘设置成非满拖
|
|
|
+ wmsBoxInfo.setIsFull("N");
|
|
|
+ wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
|
|
|
+
|
|
|
InvLotLocId query = new InvLotLocId();
|
|
|
query.setLotnum(unlockForm.getLotnum());
|
|
|
query.setSku(unlockForm.getSku());
|
|
@@ -571,7 +583,6 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
detailsQuery.setSku(qtt.getSku());
|
|
|
List<WmsDocAsnDetails> details = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(detailsQuery);
|
|
|
for (WmsDocAsnDetails d : details) {
|
|
|
- //TODO 修改入库单状态
|
|
|
wmsDocAsnDetailsMapper.updateWmsReceivedQty(d.getAsnNo(), d.getAsnLineNo().intValue(), BigDecimal.valueOf(-1 * inv.getQty().doubleValue()), "30");
|
|
|
}
|
|
|
//查询入库单明细并进行修改
|
|
@@ -603,4 +614,19 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
public List<WmsDocAsnDetails> selectStockingList(List<String> asnNos) {
|
|
|
return wmsDocAsnDetailsMapper.selectStockingList(asnNos);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CodeSkuRelationshipVO searchSn(SnCheckForm snCheckForm) {
|
|
|
+ CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.snCheck(snCheckForm.getSn());
|
|
|
+ if (snCheckForm.getAsnNoList() != null) {
|
|
|
+ Double receivedQty = wmsDocAsnHeaderMapper.selectReceivedQtyByAsnNos(codeSkuRelationshipVO.getSku(), snCheckForm.getAsnNoList());
|
|
|
+ if (receivedQty == null) {
|
|
|
+ receivedQty = 0d;
|
|
|
+ }
|
|
|
+ codeSkuRelationshipVO.setReceivedQty(receivedQty);
|
|
|
+ } else {
|
|
|
+ codeSkuRelationshipVO.setReceivedQty(0d);
|
|
|
+ }
|
|
|
+ return codeSkuRelationshipVO;
|
|
|
+ }
|
|
|
}
|