|
@@ -1,11 +1,18 @@
|
|
package com.ruoyi.ams.order.service.impl;
|
|
package com.ruoyi.ams.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import com.ruoyi.ams.box.domain.WmsBoxInfo;
|
|
import com.ruoyi.ams.box.domain.WmsBoxInfo;
|
|
import com.ruoyi.ams.box.mapper.WmsBoxInfoMapper;
|
|
import com.ruoyi.ams.box.mapper.WmsBoxInfoMapper;
|
|
import com.ruoyi.ams.box.service.IWmsBoxInfoService;
|
|
import com.ruoyi.ams.box.service.IWmsBoxInfoService;
|
|
|
|
+import com.ruoyi.ams.business.IBusinessService;
|
|
|
|
+import com.ruoyi.ams.config.domain.FlowConfigHeader;
|
|
|
|
+import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
|
|
|
|
+import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
|
|
|
|
+import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
|
|
import com.ruoyi.ams.inv.domain.InvLotAtt;
|
|
import com.ruoyi.ams.inv.domain.InvLotAtt;
|
|
import com.ruoyi.ams.inv.domain.InvLotLocId;
|
|
import com.ruoyi.ams.inv.domain.InvLotLocId;
|
|
import com.ruoyi.ams.inv.mapper.InvLotAttMapper;
|
|
import com.ruoyi.ams.inv.mapper.InvLotAttMapper;
|
|
@@ -20,10 +27,16 @@ import com.ruoyi.ams.order.form.PickInfoForm;
|
|
import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
|
|
import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
|
|
import com.ruoyi.ams.order.service.IActAllocationDetailsService;
|
|
import com.ruoyi.ams.order.service.IActAllocationDetailsService;
|
|
import com.ruoyi.ams.order.vo.StockOrderVO;
|
|
import com.ruoyi.ams.order.vo.StockOrderVO;
|
|
|
|
+import com.ruoyi.ams.task.domain.WcsTask;
|
|
|
|
+import com.ruoyi.ams.task.service.IWcsTaskService;
|
|
import com.ruoyi.base.constant.Constant;
|
|
import com.ruoyi.base.constant.Constant;
|
|
|
|
+import com.ruoyi.base.domain.BaseLocationInfo;
|
|
|
|
+import com.ruoyi.base.domain.vo.CodeSkuRelationshipVO;
|
|
import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
|
|
+import com.ruoyi.base.service.ICodeSkuRelationshipService;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -60,7 +73,13 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
@Autowired
|
|
@Autowired
|
|
private InvLotAttMapper invLotAttMapper;
|
|
private InvLotAttMapper invLotAttMapper;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IBusinessService businessService;
|
|
|
|
+ @Autowired
|
|
private IBaseLocationInfoService baseLocationInfoService;
|
|
private IBaseLocationInfoService baseLocationInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IFlowConfigHeaderService flowConfigHeaderService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICodeSkuRelationshipService codeSkuRelationshipService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询出库单头
|
|
* 查询出库单头
|
|
@@ -184,10 +203,13 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
for (WmsDocOrderDetails o : orderDetails) {
|
|
for (WmsDocOrderDetails o : orderDetails) {
|
|
AjaxResult result = wmsDocOrderHeaderService.doAllocationDetails(orderHeader, o);
|
|
AjaxResult result = wmsDocOrderHeaderService.doAllocationDetails(orderHeader, o);
|
|
if ((int) result.get(AjaxResult.CODE_TAG) != 500) {
|
|
if ((int) result.get(AjaxResult.CODE_TAG) != 500) {
|
|
|
|
+ isAllocation = true;
|
|
BigDecimal current = new BigDecimal(result.get(AjaxResult.DATA_TAG).toString());
|
|
BigDecimal current = new BigDecimal(result.get(AjaxResult.DATA_TAG).toString());
|
|
total = total.subtract(current);
|
|
total = total.subtract(current);
|
|
if (total.compareTo(BigDecimal.ZERO) == 1) {
|
|
if (total.compareTo(BigDecimal.ZERO) == 1) {
|
|
isbf = true;
|
|
isbf = true;
|
|
|
|
+ } else {
|
|
|
|
+ isbf = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -243,6 +265,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
orderQty = orderQty.subtract(allocatedQty);
|
|
orderQty = orderQty.subtract(allocatedQty);
|
|
//修改出库单状态
|
|
//修改出库单状态
|
|
details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
|
|
details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
|
|
|
|
+ details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(allocatedQty));
|
|
details.setLineStatus("10");
|
|
details.setLineStatus("10");
|
|
wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
|
|
wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
|
|
|
|
|
|
@@ -264,6 +287,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
//修改出库单状态
|
|
//修改出库单状态
|
|
details.setLineStatus("20");
|
|
details.setLineStatus("20");
|
|
details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
|
|
details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
|
|
|
|
+ details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(allocatedQty));
|
|
wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
|
|
wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
|
|
|
|
|
|
header.setOrderStatus("20");
|
|
header.setOrderStatus("20");
|
|
@@ -277,6 +301,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
BigDecimal currentQty = orderQty;
|
|
BigDecimal currentQty = orderQty;
|
|
inv.setQtyallocated(inv.getQtyallocated().add(currentQty));
|
|
inv.setQtyallocated(inv.getQtyallocated().add(currentQty));
|
|
inv.setQtyallocatedEach(inv.getQtyallocatedEach().add(currentQty));
|
|
inv.setQtyallocatedEach(inv.getQtyallocatedEach().add(currentQty));
|
|
|
|
+ details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(currentQty));
|
|
if (invLotLocIdService.updateInvLotLocId(inv) > 0) {
|
|
if (invLotLocIdService.updateInvLotLocId(inv) > 0) {
|
|
//修改出库单状态
|
|
//修改出库单状态
|
|
details.setLineStatus("10");
|
|
details.setLineStatus("10");
|
|
@@ -301,14 +326,12 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
@Override
|
|
@Override
|
|
public AjaxResult toPick(PickForm pickForm) {
|
|
public AjaxResult toPick(PickForm pickForm) {
|
|
List<PickInfoForm> pickInfoFormList = pickForm.getPickInfoFormList();
|
|
List<PickInfoForm> pickInfoFormList = pickForm.getPickInfoFormList();
|
|
|
|
+ Map<String, String> exitsMap = new HashMap<>();
|
|
for (PickInfoForm p : pickInfoFormList) {
|
|
for (PickInfoForm p : pickInfoFormList) {
|
|
String locationTo = p.getLocationTo();
|
|
String locationTo = p.getLocationTo();
|
|
- if (StringUtils.isEmpty(locationTo)) {
|
|
|
|
- //TODO 分配可用库位
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //查询对应的分配明细表
|
|
|
|
|
|
+ //TODO 任务完成后更新 查询对应的分配明细表
|
|
ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(p.getAllocationId());
|
|
ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(p.getAllocationId());
|
|
|
|
+ String location = actAllocationDetails.getLocationId().toString();
|
|
//qty = actAllocationDetails.getPickQty();
|
|
//qty = actAllocationDetails.getPickQty();
|
|
//actAllocationDetails.setPickQty(actAllocationDetails.getPickQty().add(new BigDecimal(p.getQty())));
|
|
//actAllocationDetails.setPickQty(actAllocationDetails.getPickQty().add(new BigDecimal(p.getQty())));
|
|
//actAllocationDetails.setPickToLocation(locationTo);
|
|
//actAllocationDetails.setPickToLocation(locationTo);
|
|
@@ -330,8 +353,21 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
invLotLocIdService.stockTransfer(actAllocationDetails.getLocationId(), Long.parseLong(locationTo));
|
|
invLotLocIdService.stockTransfer(actAllocationDetails.getLocationId(), Long.parseLong(locationTo));
|
|
//托盘进行绑定修改
|
|
//托盘进行绑定修改
|
|
wmsBoxInfoMapper.updateLocationBind(actAllocationDetails.getLocationId(), Long.parseLong(locationTo), null);
|
|
wmsBoxInfoMapper.updateLocationBind(actAllocationDetails.getLocationId(), Long.parseLong(locationTo), null);
|
|
- //TODO 是否需要生成任务
|
|
|
|
-
|
|
|
|
|
|
+ if (!exitsMap.containsKey(location)) {
|
|
|
|
+ exitsMap.put(location, location);
|
|
|
|
+ //生成任务退回
|
|
|
|
+ FlowConfigHeaderVO flowConfigHeader = flowConfigHeaderService.selectFlowConfigHeaderById(4L);
|
|
|
|
+ AgvCallDTO agvCallDTO = new AgvCallDTO();
|
|
|
|
+ agvCallDTO.setId(flowConfigHeader.getId());
|
|
|
|
+ agvCallDTO.setLocationFrom(location);
|
|
|
|
+ agvCallDTO.setLocationTo(p.getLocationTo());
|
|
|
|
+ agvCallDTO.setPalletNo(actAllocationDetails.getUserdefine1());
|
|
|
|
+ agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
|
|
|
|
+ AjaxResult result = businessService.agvCall(flowConfigHeader, agvCallDTO);
|
|
|
|
+ if ((int) result.get(AjaxResult.CODE_TAG) == 500) {
|
|
|
|
+ throw new ServiceException("任务生成失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return AjaxResult.success("操作成功");
|
|
return AjaxResult.success("操作成功");
|
|
}
|
|
}
|
|
@@ -413,15 +449,42 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public AjaxResult arrangeStock(ArrangeStockForm arrangeStockForm) {
|
|
public AjaxResult arrangeStock(ArrangeStockForm arrangeStockForm) {
|
|
- //把拣货库位上的库存移动到一个新的托盘上
|
|
|
|
- ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(arrangeStockForm.getAllocationId());
|
|
|
|
- WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(arrangeStockForm.getPalletNo());
|
|
|
|
- //修改托盘状态
|
|
|
|
- wmsBoxInfo.setIsFull("N");
|
|
|
|
- wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
|
|
|
|
- //库存进行移动
|
|
|
|
- invLotLocIdService.stockTransferPick(Long.parseLong(actAllocationDetails.getPickToLocation()), wmsBoxInfo.getLocationId(), actAllocationDetails.getLotnum(), new BigDecimal(arrangeStockForm.getQty()));
|
|
|
|
- //TODO 生成任务退回
|
|
|
|
|
|
+ //查询托盘
|
|
|
|
+ WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(arrangeStockForm.getPalletNoTo());
|
|
|
|
+ //物料绑定关系
|
|
|
|
+ CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(arrangeStockForm.getSn());
|
|
|
|
+ String sku = codeSkuRelationshipVO.getSku();
|
|
|
|
+ //查询分配记录
|
|
|
|
+ ActAllocationDetails query = new ActAllocationDetails();
|
|
|
|
+ query.setMaterial(sku);
|
|
|
|
+ query.setOrderNo(arrangeStockForm.getOrderNo());
|
|
|
|
+ query.setUserdefine1(arrangeStockForm.getPalletNoFrom());
|
|
|
|
+ List<ActAllocationDetails> actAllocationDetailsList = actAllocationDetailsService.selectActAllocationDetailsList(query);
|
|
|
|
+ if (actAllocationDetailsList == null || actAllocationDetailsList.size() == 0) {
|
|
|
|
+ return AjaxResult.error("查询不到分配记录");
|
|
|
|
+ }
|
|
|
|
+ for (ActAllocationDetails actAllocationDetails : actAllocationDetailsList) {
|
|
|
|
+ //把拣货库位上的库存移动到一个新的托盘上
|
|
|
|
+ actAllocationDetails.setPickToLocation(wmsBoxInfo.getLocationId().toString());
|
|
|
|
+ actAllocationDetails.setPickQty(new BigDecimal(arrangeStockForm.getQty()));
|
|
|
|
+ actAllocationDetails.setStatus("40");
|
|
|
|
+ actAllocationDetailsService.updateActAllocationDetails(actAllocationDetails);
|
|
|
|
+ //修改托盘状态
|
|
|
|
+ wmsBoxInfo.setIsFull("N");
|
|
|
|
+ wmsBoxInfo.setUserdefine1(arrangeStockForm.getBoxNo());
|
|
|
|
+ wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
|
|
|
|
+ //库存进行移动
|
|
|
|
+ invLotLocIdService.stockTransferPick(actAllocationDetails.getLocationId(), wmsBoxInfo.getLocationId(), actAllocationDetails.getLotnum(), new BigDecimal(arrangeStockForm.getQty()), arrangeStockForm.getBoxNo());
|
|
|
|
+ }
|
|
return AjaxResult.success("操作成功");
|
|
return AjaxResult.success("操作成功");
|
|
|
|
+ //ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(arrangeStockForm.getAllocationId());
|
|
|
|
+ //生成任务退回
|
|
|
|
+ /*FlowConfigHeaderVO flowConfigHeader = flowConfigHeaderService.selectFlowConfigHeaderById(3L);
|
|
|
|
+ AgvCallDTO agvCallDTO = new AgvCallDTO();
|
|
|
|
+ agvCallDTO.setId(flowConfigHeader.getId());
|
|
|
|
+ agvCallDTO.setLocationFrom(actAllocationDetails.getLocationId().toString());
|
|
|
|
+ agvCallDTO.setPalletNo(arrangeStockForm.getPalletNo());
|
|
|
|
+ agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
|
|
|
|
+ return businessService.agvCall(flowConfigHeader, agvCallDTO);*/
|
|
}
|
|
}
|
|
}
|
|
}
|