|
|
|
@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class WmsToWCSmissionServiceImpl implements IWmsToWCSmissionService {
|
|
|
|
@ -22,12 +23,19 @@ public class WmsToWCSmissionServiceImpl implements IWmsToWCSmissionService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsRawOrderInSnMapper wmsRawOrderInSnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsFpStorageNewsSnMapper wmsFpStorageNewsSnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsFpStorageNewsMapper wmsFpStorageNewsMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsOdsMateStorageNewsSnMapper wmsOdsMateStorageNewsSnMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsOdsEmStorageNewsMapper wmsOdsEmStorageNewsMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsOdsMateStorageNewsMapper wmsOdsMateStorageNewsMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsSellOutEmbryoMapper wmsSellOutEmbryoMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private WmsProductPutTrayCodeMapper wmsProductPutTrayCodeMapper;
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSODTO packagingStorage(WmsToWCSDTO wcsdto) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wcsdto.getFactory());
|
|
|
|
@ -153,5 +161,175 @@ public class WmsToWCSmissionServiceImpl implements IWmsToWCSmissionService {
|
|
|
|
|
return wcsdto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSODTO finishedProductRequestInbound(WmsToWCSDTO wcsdto) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wcsdto.getFactory());
|
|
|
|
|
//其中wcsdto的rfidNo属性先传托盘号,,原因---还没有自动码垛
|
|
|
|
|
WmsToWCSDTO wmsToWCSDTO = wmsRawOrderInMapper.finishedProductRequestInbound(wcsdto);
|
|
|
|
|
|
|
|
|
|
List<String> items=wmsRawOrderInMapper.finishedProductRequestInboundsn(wcsdto);
|
|
|
|
|
// wmsToWCSDTO.set//
|
|
|
|
|
if (wmsToWCSDTO == null) {
|
|
|
|
|
WmsToWCSODTO wms = new WmsToWCSODTO();
|
|
|
|
|
wms.setCode("0");
|
|
|
|
|
wms.setReqCode(wcsdto.getReqCode());
|
|
|
|
|
wms.setMessage("OK");
|
|
|
|
|
return wms;
|
|
|
|
|
}
|
|
|
|
|
wmsToWCSDTO.setQualityStatus("1");
|
|
|
|
|
wmsToWCSDTO.setItems(items);
|
|
|
|
|
wmsToWCSDTO.setCode("0");
|
|
|
|
|
wmsToWCSDTO.setReqCode(wcsdto.getReqCode());
|
|
|
|
|
wmsToWCSDTO.setMessage("OK");
|
|
|
|
|
WmsToWCSODTO wmsToWCSODTO = new WmsToWCSODTO();
|
|
|
|
|
wmsToWCSODTO.setCode("0");
|
|
|
|
|
|
|
|
|
|
// 创建Gson对象
|
|
|
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
|
|
|
|
|
|
|
|
|
// 将对象转换为JSON格式的字符串并格式化输出
|
|
|
|
|
String MESSAGE = gson.toJson(wmsToWCSDTO);
|
|
|
|
|
|
|
|
|
|
wmsToWCSODTO.setMessage(MESSAGE);
|
|
|
|
|
return wmsToWCSODTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSDTO finishedProductInboundCompleted(WmsToWCSDTO wmsToWCSDTO) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wmsToWCSDTO.getFactory());
|
|
|
|
|
// //wms_raw_order_in_sn
|
|
|
|
|
// WmsRawOrderInSn wmsRawOrderInSn = wmsRawOrderInSnMapper.selectwmsRfidNo(wmsToWCSDTO);
|
|
|
|
|
// wmsRawOrderInSn.setWhCode(wmsToWCSDTO.getWarehouseNo());
|
|
|
|
|
// wmsRawOrderInSn.setWlCode(wmsToWCSDTO.getLocation());
|
|
|
|
|
// WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn = new WmsOdsMateStorageNewsSn();
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setWhCode(wmsRawOrderInSn.getWhCode());//仓库编码
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setWlCode(wmsRawOrderInSn.getWlCode());//库位编码
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setMaterialDesc(wmsRawOrderInSn.getMaterialDesc());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setSn(wmsRawOrderInSn.getSn());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setCreateBy("AGV");
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setActiveFlag("1");
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setGmtCreate(new Date());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setMateOrderInSnId(IdUtils.fastSimpleUUID());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setFactoryCode(wmsToWCSDTO.getFactory());
|
|
|
|
|
// wmsOdsMateStorageNewsSn.setSapFactoryCode(wmsToWCSDTO.getFactory());
|
|
|
|
|
// //wms_ods_mate_storage_news_sn
|
|
|
|
|
// wmsOdsMateStorageNewsSnMapper.insertWmsOdsMateStorageNewsSn(wmsOdsMateStorageNewsSn);
|
|
|
|
|
// //修改库存
|
|
|
|
|
// //2,修改库存---/加库存数量--storage_amount = IFNULL(storage_amount, 0) + #{amount},
|
|
|
|
|
// WmsOdsEmStorageNews wmsOdsEmStorageNews = new WmsOdsEmStorageNews();
|
|
|
|
|
// wmsOdsEmStorageNews.setWhCode(wmsRawOrderInSn.getWhCode());//仓库编码
|
|
|
|
|
// wmsOdsEmStorageNews.setWlCode(wmsRawOrderInSn.getWlCode());//库位编码
|
|
|
|
|
// wmsOdsEmStorageNews.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
// wmsOdsEmStorageNews.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
//
|
|
|
|
|
// //添加库存--这个要有个判断有没有这个库存如果没有的话,就插入
|
|
|
|
|
// WmsOdsMateStorageNews wmsOdsMateStorageNews = wmsOdsMateStorageNewsMapper.selectByWhCodeAndMate(wmsOdsEmStorageNews);
|
|
|
|
|
// if (wmsOdsMateStorageNews == null) {
|
|
|
|
|
// WmsOdsMateStorageNews wmsOdsMateStorageNews1 = new WmsOdsMateStorageNews();
|
|
|
|
|
// wmsOdsMateStorageNews1.setStorageId(IdUtils.fastSimpleUUID());
|
|
|
|
|
// wmsOdsMateStorageNews1.setWhCode(wmsRawOrderInSn.getWhCode());
|
|
|
|
|
// wmsOdsMateStorageNews1.setWlCode(wmsRawOrderInSn.getWlCode());
|
|
|
|
|
// wmsOdsMateStorageNews1.setAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
// // wmsOdsMateStorageNews1.setStorageAmount(wmsRawOrderInSn.getAmount());
|
|
|
|
|
// wmsOdsMateStorageNews1.setMaterialCode(wmsRawOrderInSn.getMaterialCode());
|
|
|
|
|
// wmsOdsMateStorageNews1.setMaterialDesc(wmsRawOrderInSn.getMaterialDesc());
|
|
|
|
|
// wmsOdsMateStorageNews1.setStorageType("BC");
|
|
|
|
|
// wmsOdsMateStorageNews1.setCreateBy("wcs");
|
|
|
|
|
// wmsOdsMateStorageNews1.setGmtCreate(new Date());
|
|
|
|
|
// wmsOdsMateStorageNews1.setActiveFlag("1");
|
|
|
|
|
// wmsOdsMateStorageNews1.setFactoryCode(wmsToWCSDTO.getFactory());
|
|
|
|
|
// wmsOdsMateStorageNews1.setSapFactoryCode(wmsToWCSDTO.getFactory());
|
|
|
|
|
// wmsOdsMateStorageNews1.setUserDefined1(wmsRawOrderInSn.getUserDefined4());//单位
|
|
|
|
|
// wmsOdsMateStorageNewsMapper.insertWmsOdsMateStorageNews(wmsOdsMateStorageNews1);
|
|
|
|
|
// } else {
|
|
|
|
|
// wmsOdsMateStorageNewsSnMapper.updateAdd(wmsOdsEmStorageNews);
|
|
|
|
|
// }
|
|
|
|
|
// //修改托盘记录为入库
|
|
|
|
|
// wmsRawOrderInSnMapper.updateU1Byid(wmsRawOrderInSn);
|
|
|
|
|
//在入库手持那里已经入了,他没有用rfid而是托盘,但是成品手持下线入库,在下下线入库那里已经入了,除非后续用自动码垛,不用手持的下线入库
|
|
|
|
|
wmsToWCSDTO.setCode("0");
|
|
|
|
|
wmsToWCSDTO.setMessage("OK");
|
|
|
|
|
return wmsToWCSDTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSDTO finishedProductOutBoundCompleted(WmsToWCSDTO wcsdto) {
|
|
|
|
|
//记录明细消减库存--wms_raw_mission_out-
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + wcsdto.getFactory());
|
|
|
|
|
WmsSellOutEmbryo wmsSellOutEmbryo=new WmsSellOutEmbryo();
|
|
|
|
|
wmsSellOutEmbryo.setDeliveryOrder(wcsdto.getOrderNo());//查询对应的销售订单
|
|
|
|
|
List<WmsSellOutEmbryo> wmsSellOutEmbryos = wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoList(wmsSellOutEmbryo);
|
|
|
|
|
WmsSellOutEmbryo wmsSellOutEmbryo1=wmsSellOutEmbryos.get(0);
|
|
|
|
|
|
|
|
|
|
WmsToWCSDTO wmsToWCSDTO = wmsRawOrderInMapper.finishedProductRequestInbound(wcsdto);//根据托盘查询明细
|
|
|
|
|
//修改销售订单
|
|
|
|
|
String tem= wmsToWCSDTO.getQty();
|
|
|
|
|
BigDecimal OutQuantity= wmsSellOutEmbryo1.getOutQuantity().add(new BigDecimal(tem));//2
|
|
|
|
|
int result = wmsSellOutEmbryo1.getPlanQuantity().compareTo(OutQuantity);
|
|
|
|
|
WmsSellOutEmbryo wmsSellOutEmbryoUpdate=new WmsSellOutEmbryo();
|
|
|
|
|
if (result == 0){//出库完
|
|
|
|
|
wmsSellOutEmbryoUpdate.setStatus("1");
|
|
|
|
|
}else {
|
|
|
|
|
wmsSellOutEmbryoUpdate.setStatus("0");
|
|
|
|
|
}
|
|
|
|
|
wmsSellOutEmbryoUpdate.setDeliveryOrder(wcsdto.getOrderNo());
|
|
|
|
|
wmsSellOutEmbryoUpdate.setOutQuantity(OutQuantity);
|
|
|
|
|
wmsSellOutEmbryoMapper.updateWmsSellOutEmbryotwo(wmsSellOutEmbryoUpdate);
|
|
|
|
|
//订单修改完成
|
|
|
|
|
//
|
|
|
|
|
WmsProductPutTrayCode wmsProductPutTrayCode=new WmsProductPutTrayCode();
|
|
|
|
|
//解除绑定
|
|
|
|
|
wmsProductPutTrayCode.setSn(wcsdto.getRfidNo());//托盘号
|
|
|
|
|
wmsProductPutTrayCode.setWlCode(wmsToWCSDTO.getWlcode());//库位
|
|
|
|
|
wmsProductPutTrayCode.setRelatStatus("0");
|
|
|
|
|
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
|
|
|
|
|
//改明细
|
|
|
|
|
WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn();
|
|
|
|
|
wmsFpStorageNewsSn.setSn(wmsProductPutTrayCode.getSn());
|
|
|
|
|
wmsFpStorageNewsSn.setWlCode(wmsProductPutTrayCode.getWlCode());
|
|
|
|
|
wmsFpStorageNewsSn.setActiveFlag("1");
|
|
|
|
|
wmsFpStorageNewsSn.setProductCode(wmsSellOutEmbryo1.getProductCode());
|
|
|
|
|
wmsFpStorageNewsSnMapper.updateWmsFpStorageNewsSnOut(wmsFpStorageNewsSn);
|
|
|
|
|
//判断如果托盘数据被出完,就关闭这个明细
|
|
|
|
|
List<WmsFpStorageNewsSn> wmsFpStorageNewsSns= wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnList(wmsFpStorageNewsSn);
|
|
|
|
|
if (wmsFpStorageNewsSns.size()>0){
|
|
|
|
|
WmsFpStorageNewsSn wmsFpStorageNewsSn1= wmsFpStorageNewsSns.get(0);
|
|
|
|
|
|
|
|
|
|
BigDecimal ken= new BigDecimal(wmsFpStorageNewsSn1.getUserDefined2());
|
|
|
|
|
int comparisonResult = ken.compareTo(wmsFpStorageNewsSn1.getAmount());
|
|
|
|
|
if (comparisonResult == 0) {
|
|
|
|
|
// ken和amount相等
|
|
|
|
|
wmsFpStorageNewsSn1.setActiveFlag("0");
|
|
|
|
|
//修改明细
|
|
|
|
|
wmsFpStorageNewsSnMapper.updateWmsFpStorageNewsSn(wmsFpStorageNewsSn1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//改主库存表
|
|
|
|
|
WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews();
|
|
|
|
|
wmsFpStorageNews.setActiveFlag("1");
|
|
|
|
|
wmsFpStorageNews.setWlCode(wmsProductPutTrayCode.getWlCode());
|
|
|
|
|
wmsFpStorageNews.setProductCode(wmsSellOutEmbryo1.getProductCode());
|
|
|
|
|
wmsFpStorageNewsMapper.updateWmsFpStorageNewsOut(wmsFpStorageNews);
|
|
|
|
|
wcsdto.setCode("0");
|
|
|
|
|
wcsdto.setMessage("OK");
|
|
|
|
|
return wcsdto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSDTO finishedProductOutBoundScanReply(WmsToWCSDTO wcsdto) {
|
|
|
|
|
wcsdto.setCode("0");
|
|
|
|
|
wcsdto.setMessage("OK");
|
|
|
|
|
return wcsdto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsToWCSDTO liftTakeOrPutCompleted(WmsToWCSDTO wcsdto) {
|
|
|
|
|
wcsdto.setCode("0");
|
|
|
|
|
wcsdto.setMessage("OK");
|
|
|
|
|
return wcsdto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|