|
@@ -182,6 +182,24 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
|
}*/
|
|
|
return result;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 新增出库单头
|
|
|
+ *
|
|
|
+ * @param wmsDocOrderHeader 出库单头
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public int insertWmsDocOrderHeader(WmsDocOrderHeader wmsDocOrderHeader,String orderNo) {
|
|
|
+ wmsDocOrderHeader.setOrderNo(orderNo);
|
|
|
+ wmsDocOrderHeader.setEdiSendFlag("N");
|
|
|
+ int result = wmsDocOrderHeaderMapper.insertWmsDocOrderHeader(wmsDocOrderHeader);
|
|
|
+ /*List<WmsDocOrderDetails> orderDetails = wmsDocOrderHeader.getWmsDocOrderDetailsList();
|
|
|
+ for (WmsDocOrderDetails de : orderDetails) {
|
|
|
+ wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
|
|
|
+ }*/
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改出库单头
|
|
@@ -1346,65 +1364,79 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public AjaxResult invTally(InvTallyForm invTallyForm) {
|
|
|
+ List<InvLotLocIdLotattVO> endInvList = new ArrayList<>(); //最终操作的库存
|
|
|
+ // 校验
|
|
|
+ List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invTallyForm.getInvLotLocIdLotattVOS();
|
|
|
+ for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOList) {
|
|
|
+ InvLotLocIdLotattVO locIdLotattVO = null;
|
|
|
+ InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
|
|
|
+ invLocIdSearchFrom.setLotnum(invLotLocIdLotattVO.getLotnum());
|
|
|
+ invLocIdSearchFrom.setSku(invLotLocIdLotattVO.getSku());
|
|
|
+ invLocIdSearchFrom.setLocationId(invLotLocIdLotattVO.getLocationId().toString());
|
|
|
+ List<InvLotLocIdLotattVO> lotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
|
|
|
+ if (lotLocIdLotattVOList.size() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ locIdLotattVO = lotLocIdLotattVOList.get(0);
|
|
|
+ // 满托不可理货
|
|
|
+ if (StringUtils.isNotEmpty(locIdLotattVO.getIsFull())
|
|
|
+ && locIdLotattVO.getIsFull().equals(Constant.IS_YES.Y.getValue())) {
|
|
|
+ return AjaxResult.error("不可选择满托物料!库位号:" + locIdLotattVO.getLocationNo());
|
|
|
+ }
|
|
|
+ // 已经分配的库存不可理货
|
|
|
+ if (StringUtils.isNotEmpty(locIdLotattVO.getLotatt15())) {
|
|
|
+ return AjaxResult.error("不可选择已分配库存!库位号:" + locIdLotattVO.getLocationNo());
|
|
|
+ }
|
|
|
+ // 判断空闲
|
|
|
+ if (!locIdLotattVO.getStockStatus().equals(Constant.STOCK_STATUS.STOCK00.getValue())) {
|
|
|
+ return AjaxResult.error("非空闲库存不可操作!库位号:" + locIdLotattVO.getLocationNo());
|
|
|
+ }
|
|
|
+ endInvList.add(locIdLotattVO);
|
|
|
+ }
|
|
|
+ if (endInvList.size() == 0) {
|
|
|
+ return AjaxResult.error("可操作库存为条数为0!");
|
|
|
+ }
|
|
|
//生成出库单
|
|
|
- //生成出库明细
|
|
|
- //生成分配
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- List<InvLotLocIdLotattVO> invList = invTallyForm.getInvLotLocIdLotattVOS();
|
|
|
String orderNo = idSequenceUtils.generateId("ORDERNO");
|
|
|
WmsDocOrderHeader header = new WmsDocOrderHeader();
|
|
|
- header.setOrderNo(orderNo);
|
|
|
header.setCustomerId(Constant.CUSTOMER_ID);
|
|
|
- header.setOrderType("LH");
|
|
|
- header.setOrderStatus("20");
|
|
|
+ header.setOrderType(Constant.ORDER_TYP.LH.getValue());
|
|
|
+ header.setOrderStatus(Constant.ORDER_STS.STS20.getValue());
|
|
|
+ header.setSoReference1(orderNo);
|
|
|
header.setCreateBy(loginUser.getUsername());
|
|
|
header.setCreateTime(new Date());
|
|
|
- Map<String, WmsDocOrderDetails> mapOrder = new HashMap<>();
|
|
|
- for (InvLotLocIdLotattVO inv : invList) {
|
|
|
- BigDecimal current = BigDecimal.valueOf(inv.getQty()).subtract(BigDecimal.valueOf(inv.getQtyallocated()));
|
|
|
- WmsDocOrderDetails de;
|
|
|
- if (mapOrder.get(inv.getSku()) == null) {
|
|
|
- de = new WmsDocOrderDetails();
|
|
|
- de.setOrderNo(orderNo);
|
|
|
- de.setOrderLineNo(BigDecimal.valueOf(mapOrder.size() + 1));
|
|
|
- de.setLineStatus("20");
|
|
|
- de.setSku(inv.getSku());
|
|
|
- de.setQtyOrdered(BigDecimal.ZERO);
|
|
|
- de.setQtyOrderedEach(BigDecimal.ZERO);
|
|
|
- de.setQtyAllocated(BigDecimal.ZERO);
|
|
|
- de.setQtyAllocatedEach(BigDecimal.ZERO);
|
|
|
- de.setQtyPicked(BigDecimal.ZERO);
|
|
|
- de.setQtyPickedEach(BigDecimal.ZERO);
|
|
|
- de.setQtyShipped(BigDecimal.ZERO);
|
|
|
- de.setQtyShippedEach(BigDecimal.ZERO);
|
|
|
- de.setCustomerId(inv.getCustomerId());
|
|
|
- de.setLotnum(inv.getLotnum());
|
|
|
- mapOrder.put(inv.getSku(), de);
|
|
|
- } else {
|
|
|
- de = mapOrder.get(inv.getSku());
|
|
|
- }
|
|
|
- de.setQtyOrdered(de.getQtyOrdered().add(current));
|
|
|
- de.setQtyOrderedEach(de.getQtyOrdered());
|
|
|
- de.setQtyAllocated(de.getQtyAllocated().add(current));
|
|
|
- de.setQtyAllocatedEach(de.getQtyAllocated());
|
|
|
+ int result = wmsDocOrderHeaderService.insertWmsDocOrderHeader(header,orderNo);
|
|
|
+ if (result <= 0) {
|
|
|
+ return AjaxResult.error("生成出库单头失败!");
|
|
|
+ }
|
|
|
+ for (InvLotLocIdLotattVO inv : endInvList) {
|
|
|
+ WmsDocOrderDetails de = new WmsDocOrderDetails();
|
|
|
+ de.setOrderNo(orderNo);
|
|
|
+ de.setLineStatus(Constant.ORDER_STS.STS20.getValue());
|
|
|
+ de.setSku(inv.getSku());
|
|
|
+ de.setCustomerId(Constant.CUSTOMER_ID);
|
|
|
+ de.setQtyOrdered(new BigDecimal(inv.getQty()));
|
|
|
+ de.setQtyOrderedEach(new BigDecimal(inv.getQty()));
|
|
|
+ de.setQtyAllocated(new BigDecimal(inv.getQty()));
|
|
|
+ de.setQtyAllocatedEach(new BigDecimal(inv.getQty()));
|
|
|
+ de.setQtyPicked(BigDecimal.ZERO);
|
|
|
+ de.setQtyPickedEach(BigDecimal.ZERO);
|
|
|
+ de.setQtyShipped(BigDecimal.ZERO);
|
|
|
+ de.setQtyShippedEach(BigDecimal.ZERO);
|
|
|
+ de.setCustomerId(inv.getCustomerId());
|
|
|
+ de.setLotnum(inv.getLotnum());
|
|
|
de.setCreateBy(loginUser.getUsername());
|
|
|
de.setCreateTime(new Date());
|
|
|
+ int i = wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
|
|
|
+ if (i <= 0) {
|
|
|
+ throw new ServiceException("出库单明细生成失败!");
|
|
|
+ }
|
|
|
|
|
|
- //更新已分配
|
|
|
- invLotLocIdMapper.updateAllocationBy(inv.getLotnum(), inv.getLocationId(), current);
|
|
|
-
|
|
|
- //生成分配表
|
|
|
- actAllocationDetailsService.addActAllocationDetails(inv.getLotnum(), inv.getLocationId().toString(), BigDecimal.valueOf(inv.getQty()), de, "00");
|
|
|
- }
|
|
|
- for (WmsDocOrderDetails de : mapOrder.values()) {
|
|
|
- wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
|
|
|
- }
|
|
|
- int result = wmsDocOrderHeaderService.insertWmsDocOrderHeader(header);
|
|
|
- if (result > 0) {
|
|
|
- return AjaxResult.success("操作成功");
|
|
|
- } else {
|
|
|
- return AjaxResult.error("操作失败");
|
|
|
+ //库位对应所有库存lotatt15记录分配出库单号
|
|
|
+ invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId().toString(), orderNo);
|
|
|
}
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -1653,6 +1685,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
|
return actAllocationDetailsService.modifyAssignmentStockTaskStatusPickingComplete(orderNo, locationId, palletNo);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public AjaxResult modifyAssignmentStockTaskStatusComplete(String orderNo, Long locationId, String palletNo, boolean isBH) {
|