|
|
@ -17,9 +17,11 @@ import com.hw.mes.api.RemoteMesService;
|
|
|
|
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
|
|
|
|
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
|
|
|
|
import com.hw.wms.config.WmsConfig;
|
|
|
|
import com.hw.wms.config.WmsConfig;
|
|
|
|
import com.hw.wms.domain.WmsBaseLocation;
|
|
|
|
import com.hw.wms.domain.WmsBaseLocation;
|
|
|
|
|
|
|
|
import com.hw.wms.domain.WmsRawOutstock;
|
|
|
|
import com.hw.wms.domain.WmsRawStock;
|
|
|
|
import com.hw.wms.domain.WmsRawStock;
|
|
|
|
import com.hw.wms.domain.vo.*;
|
|
|
|
import com.hw.wms.domain.vo.*;
|
|
|
|
import com.hw.wms.mapper.WmsBaseLocationMapper;
|
|
|
|
import com.hw.wms.mapper.WmsBaseLocationMapper;
|
|
|
|
|
|
|
|
import com.hw.wms.mapper.WmsRawOutstockMapper;
|
|
|
|
import com.hw.wms.mapper.WmsRawStockMapper;
|
|
|
|
import com.hw.wms.mapper.WmsRawStockMapper;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
|
import org.springframework.http.HttpEntity;
|
|
|
@ -53,6 +55,9 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private WmsRawStockMapper wmsRawStockMapper;
|
|
|
|
private WmsRawStockMapper wmsRawStockMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private WmsRawOutstockMapper wmsRawOutstockMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private WmsConfig wmsConfig;
|
|
|
|
private WmsConfig wmsConfig;
|
|
|
|
|
|
|
|
|
|
|
@ -281,7 +286,7 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
throw new ServiceException("物料条码有误");
|
|
|
|
throw new ServiceException("物料条码有误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断此柜体是否已跟拆分门板绑定,如果未绑定不允许返库
|
|
|
|
//判断此柜体是否已跟配对码绑定,如果未绑定不允许返库
|
|
|
|
R<MesBaseBarcodeInfo> bindBarcodeInfoR = remoteMesService.getBarcodeByBindBarcode(materialBarcode, SecurityConstants.INNER);
|
|
|
|
R<MesBaseBarcodeInfo> bindBarcodeInfoR = remoteMesService.getBarcodeByBindBarcode(materialBarcode, SecurityConstants.INNER);
|
|
|
|
if (bindBarcodeInfoR == null) {
|
|
|
|
if (bindBarcodeInfoR == null) {
|
|
|
|
throw new ServiceException("没找到绑定信息,不能返库");
|
|
|
|
throw new ServiceException("没找到绑定信息,不能返库");
|
|
|
@ -291,18 +296,42 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
throw new ServiceException("没找到绑定信息,不能返库");
|
|
|
|
throw new ServiceException("没找到绑定信息,不能返库");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsRawInstock queryReturnRawInstock = new WmsRawInstock();
|
|
|
|
|
|
|
|
queryReturnRawInstock.setReturnFlag("1");
|
|
|
|
|
|
|
|
List<WmsRawInstock> returnRawInstocks = wmsRawInstockMapper.selectWmsRawInstockList(queryReturnRawInstock);
|
|
|
|
|
|
|
|
if (returnRawInstocks != null && !returnRawInstocks.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("有正在返库的记录,不能再次申请");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsRawInstock queryPlanRawInstock = new WmsRawInstock();
|
|
|
|
|
|
|
|
queryPlanRawInstock.setPlanDetailCode(wmsRawBackVo.getPlanDetailCode());
|
|
|
|
|
|
|
|
List<WmsRawInstock> planRawInstocks = wmsRawInstockMapper.selectWmsRawInstockList(queryPlanRawInstock);
|
|
|
|
|
|
|
|
if (planRawInstocks != null && !planRawInstocks.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("此生产明细已经申请过返库,无需重复申请");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//4楼上5楼的不需要申请领柜体,所以也不需要返库
|
|
|
|
|
|
|
|
WmsRawOutstock queryRawOutsotck = new WmsRawOutstock();
|
|
|
|
|
|
|
|
queryRawOutsotck.setPlanDetailCode(wmsRawBackVo.getPlanDetailCode());
|
|
|
|
|
|
|
|
queryRawOutsotck.setSplitFlag(WmsConstants.WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES);
|
|
|
|
|
|
|
|
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutsotck);
|
|
|
|
|
|
|
|
if (wmsRawOutstocks == null || wmsRawOutstocks.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("没有领取柜体,无需返库");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!baseBarcodeInfo.getPlanDetailCode().equals(wmsRawBackVo.getPlanDetailCode())) {
|
|
|
|
|
|
|
|
throw new ServiceException(String.format("此物料条码明细编号为%s:,与此明细编号不符", baseBarcodeInfo.getPlanDetailCode()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否有返库记录,不能重复提交
|
|
|
|
//判断是否有返库记录,不能重复提交
|
|
|
|
WmsRawInstock queryRawInstock = new WmsRawInstock();
|
|
|
|
WmsRawInstock queryRawInstock = new WmsRawInstock();
|
|
|
|
queryRawInstock.setMaterialBarcode(materialBarcode);//materialBarcode是索引,先不需要加别的条件,获取出来再过滤
|
|
|
|
queryRawInstock.setMaterialBarcode(materialBarcode);
|
|
|
|
|
|
|
|
queryRawInstock.setInstockType(WmsConstants.RAW_INSTOCK_INSTOCK_TYPE_RETURN);
|
|
|
|
List<WmsRawInstock> wmsRawInstocks = wmsRawInstockMapper.selectWmsRawInstockList(queryRawInstock);
|
|
|
|
List<WmsRawInstock> wmsRawInstocks = wmsRawInstockMapper.selectWmsRawInstockList(queryRawInstock);
|
|
|
|
if (wmsRawInstocks != null && !wmsRawInstocks.isEmpty()) {
|
|
|
|
if (wmsRawInstocks != null && !wmsRawInstocks.isEmpty()) {
|
|
|
|
List<WmsRawInstock> returnRawInstocks = wmsRawInstocks.stream().filter
|
|
|
|
|
|
|
|
(wmsRawInstock -> wmsRawInstock.getInstockType().equals(WmsConstants.RAW_INSTOCK_INSTOCK_TYPE_RETURN))
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (returnRawInstocks != null && !returnRawInstocks.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("已经有此物料返库记录,无需重复返库");
|
|
|
|
throw new ServiceException("已经有此物料返库记录,无需重复返库");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WmsRawInstock wmsRawInstock = new WmsRawInstock();
|
|
|
|
WmsRawInstock wmsRawInstock = new WmsRawInstock();
|
|
|
|
wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode));
|
|
|
|
wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode));
|
|
|
@ -316,6 +345,8 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
|
|
|
|
wmsRawInstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());
|
|
|
|
wmsRawInstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());
|
|
|
|
wmsRawInstock.setInstockAmount(BigDecimal.ONE);
|
|
|
|
wmsRawInstock.setInstockAmount(BigDecimal.ONE);
|
|
|
|
wmsRawInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
|
|
|
|
wmsRawInstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
|
|
|
|
|
|
|
|
wmsRawInstock.setReturnFlag("1");//返回标识,只能有一个returnflag为1的。
|
|
|
|
|
|
|
|
wmsRawInstock.setPlanDetailCode(wmsRawBackVo.getPlanDetailCode());
|
|
|
|
wmsRawInstock.setApplyBy(SecurityUtils.getUsername());
|
|
|
|
wmsRawInstock.setApplyBy(SecurityUtils.getUsername());
|
|
|
|
wmsRawInstock.setApplyDate(new Date());
|
|
|
|
wmsRawInstock.setApplyDate(new Date());
|
|
|
|
|
|
|
|
|
|
|
|