|
|
|
@ -2462,86 +2462,89 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
public String NewConMaterialOutSCNew(List<OdsProcureOutOrder> orderList, List<OdsProcureOutOrder> gzList) {
|
|
|
|
|
//orderList标识卡这个要·注意重复过账,,gzList注意重复过账--就判断是否有对应标识卡未过账,如果未过账就进行过账
|
|
|
|
|
String result="操作成功";
|
|
|
|
|
String factoryCode = orderList.get(0).getFactoryCode();
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + factoryCode);
|
|
|
|
|
//我可以在这个循环里面
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder :
|
|
|
|
|
orderList) {
|
|
|
|
|
//领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
|
|
|
|
|
String produceCode= odsProcureOutOrder.getProduceCode();//生产领料单号
|
|
|
|
|
String createBy= odsProcureOutOrder.getCreateBy();//操作人
|
|
|
|
|
String mateOrderInSnId= odsProcureOutOrder.getMateOrderInSnId();
|
|
|
|
|
String waCode= odsProcureOutOrder.getWaCode();
|
|
|
|
|
String whCode= odsProcureOutOrder.getWhCode();
|
|
|
|
|
String wlCode= odsProcureOutOrder.getWlCode();
|
|
|
|
|
String sn= odsProcureOutOrder.getSn();
|
|
|
|
|
String materialCode= odsProcureOutOrder.getMaterialCode();
|
|
|
|
|
String materialDesc= odsProcureOutOrder.getMaterialDesc();
|
|
|
|
|
BigDecimal amount= odsProcureOutOrder.getAmount();//数量
|
|
|
|
|
String userDefined1= odsProcureOutOrder.getUserDefined1();//单位
|
|
|
|
|
String userDefined2= odsProcureOutOrder.getUserDefined2();//批次
|
|
|
|
|
//包材明细表
|
|
|
|
|
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn = wmsOdsMateStorageNewsSnMapper.selectWmsOdsMateStorageNewsSnByMateOrderInSnIdk(mateOrderInSnId);
|
|
|
|
|
//wms_raw_mission_out--保存
|
|
|
|
|
//ods_procure_out_order--修改
|
|
|
|
|
if(orderList.size()>0){
|
|
|
|
|
String factoryCode = orderList.get(0).getFactoryCode();
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + factoryCode);
|
|
|
|
|
//我可以在这个循环里面
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder :
|
|
|
|
|
orderList) {
|
|
|
|
|
//领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
|
|
|
|
|
String produceCode= odsProcureOutOrder.getProduceCode();//生产领料单号
|
|
|
|
|
String createBy= odsProcureOutOrder.getCreateBy();//操作人
|
|
|
|
|
String mateOrderInSnId= odsProcureOutOrder.getMateOrderInSnId();
|
|
|
|
|
String waCode= odsProcureOutOrder.getWaCode();
|
|
|
|
|
String whCode= odsProcureOutOrder.getWhCode();
|
|
|
|
|
String wlCode= odsProcureOutOrder.getWlCode();
|
|
|
|
|
String sn= odsProcureOutOrder.getSn();
|
|
|
|
|
String materialCode= odsProcureOutOrder.getMaterialCode();
|
|
|
|
|
String materialDesc= odsProcureOutOrder.getMaterialDesc();
|
|
|
|
|
BigDecimal amount= odsProcureOutOrder.getAmount();//数量
|
|
|
|
|
String userDefined1= odsProcureOutOrder.getUserDefined1();//单位
|
|
|
|
|
String userDefined2= odsProcureOutOrder.getUserDefined2();//批次
|
|
|
|
|
//包材明细表
|
|
|
|
|
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn = wmsOdsMateStorageNewsSnMapper.selectWmsOdsMateStorageNewsSnByMateOrderInSnIdk(mateOrderInSnId);
|
|
|
|
|
//wms_raw_mission_out--保存
|
|
|
|
|
//ods_procure_out_order--修改
|
|
|
|
|
// WCSInventoryPlan wcsInventoryPlan = new WCSInventoryPlan();
|
|
|
|
|
// wcsInventoryPlan.setSku(odsProcureOutOrder.getMaterialCode());
|
|
|
|
|
// WmsOdsMateStorageNews wmsOdsMateStorageNews = wmsOdsMateStorageNewsMapper.selectBaseProductByCode(wcsInventoryPlan);
|
|
|
|
|
OdsProcureOutOrder order = new OdsProcureOutOrder();
|
|
|
|
|
order.setProduceCode(produceCode);//领料单
|
|
|
|
|
order.setMaterialCode(materialCode);//
|
|
|
|
|
order.setMaterialDesc(materialDesc);
|
|
|
|
|
order.setUserDefined1(userDefined2);//批次
|
|
|
|
|
order.setUserDefined2(whCode);
|
|
|
|
|
order.setUserDefined3(wlCode);
|
|
|
|
|
order.setSn(sn);
|
|
|
|
|
order.setPlanNumber(amount);
|
|
|
|
|
order.setLocCode(waCode);//库区
|
|
|
|
|
order.setID(IdUtils.fastSimpleUUID());
|
|
|
|
|
order.setUnit(userDefined1);
|
|
|
|
|
order.setFactoryCode(factoryCode);
|
|
|
|
|
order.setActive("1");
|
|
|
|
|
order.setCreateBy(createBy);
|
|
|
|
|
order.setCreateDate(new Date());
|
|
|
|
|
OdsProcureOutOrder odsProcureOutOrder1=new OdsProcureOutOrder();
|
|
|
|
|
odsProcureOutOrder1.setProduceCode(produceCode);
|
|
|
|
|
odsProcureOutOrder1.setMaterialCode(materialCode);
|
|
|
|
|
List<OdsProcureOutOrder> odsProcureOutOrders = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrder(odsProcureOutOrder1);
|
|
|
|
|
//包材出库单----会有特殊的那种二次过账的单子--就看前端会不会传对应的标识卡了
|
|
|
|
|
OdsProcureOutOrder order1= odsProcureOutOrders.get(0);
|
|
|
|
|
order.setUserDefined4(order1.getUserDefined4());
|
|
|
|
|
//出库明细
|
|
|
|
|
odsProcureOutOrderMapper.insertWmsRawMissionOut(order);
|
|
|
|
|
//BigDecimal sapNumber =order1.getSapNumber();
|
|
|
|
|
BigDecimal realityNumber1 = order1.getOutNumber();//累出库数
|
|
|
|
|
BigDecimal realityNumber = order1.getPlanNumber();//计划
|
|
|
|
|
BigDecimal planNumber = amount;//本次实际数量
|
|
|
|
|
BigDecimal tem = realityNumber1.add(planNumber);
|
|
|
|
|
if (tem.compareTo(realityNumber)>= 0) {
|
|
|
|
|
order1.setOrderStatus("3");//3是满足出库数量
|
|
|
|
|
} else {
|
|
|
|
|
order1.setOrderStatus("2");
|
|
|
|
|
}
|
|
|
|
|
order1.setOutNumber(tem);//这样的话,就可以用已经过账的数量来计算要过账的数量,用出库数量减去已经过账的数量,就是要过账的数量,只要不为0,就可以进行
|
|
|
|
|
// WmsOdsMateStorageNews wmsOdsMateStorageNews = wmsOdsMateStorageNewsMapper.selectBaseProductByCode(wcsInventoryPlan);
|
|
|
|
|
OdsProcureOutOrder order = new OdsProcureOutOrder();
|
|
|
|
|
order.setProduceCode(produceCode);//领料单
|
|
|
|
|
order.setMaterialCode(materialCode);//
|
|
|
|
|
order.setMaterialDesc(materialDesc);
|
|
|
|
|
order.setUserDefined1(userDefined2);//批次
|
|
|
|
|
order.setUserDefined2(whCode);
|
|
|
|
|
order.setUserDefined3(wlCode);
|
|
|
|
|
order.setSn(sn);
|
|
|
|
|
order.setPlanNumber(amount);
|
|
|
|
|
order.setLocCode(waCode);//库区
|
|
|
|
|
order.setID(IdUtils.fastSimpleUUID());
|
|
|
|
|
order.setUnit(userDefined1);
|
|
|
|
|
order.setFactoryCode(factoryCode);
|
|
|
|
|
order.setActive("1");
|
|
|
|
|
order.setCreateBy(createBy);
|
|
|
|
|
order.setCreateDate(new Date());
|
|
|
|
|
OdsProcureOutOrder odsProcureOutOrder1=new OdsProcureOutOrder();
|
|
|
|
|
odsProcureOutOrder1.setProduceCode(produceCode);
|
|
|
|
|
odsProcureOutOrder1.setMaterialCode(materialCode);
|
|
|
|
|
List<OdsProcureOutOrder> odsProcureOutOrders = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrder(odsProcureOutOrder1);
|
|
|
|
|
//包材出库单----会有特殊的那种二次过账的单子--就看前端会不会传对应的标识卡了
|
|
|
|
|
OdsProcureOutOrder order1= odsProcureOutOrders.get(0);
|
|
|
|
|
order.setUserDefined4(order1.getUserDefined4());
|
|
|
|
|
//出库明细
|
|
|
|
|
odsProcureOutOrderMapper.insertWmsRawMissionOut(order);
|
|
|
|
|
//BigDecimal sapNumber =order1.getSapNumber();
|
|
|
|
|
BigDecimal realityNumber1 = order1.getOutNumber();//累出库数
|
|
|
|
|
BigDecimal realityNumber = order1.getPlanNumber();//计划
|
|
|
|
|
BigDecimal planNumber = amount;//本次实际数量
|
|
|
|
|
BigDecimal tem = realityNumber1.add(planNumber);
|
|
|
|
|
if (tem.compareTo(realityNumber)>= 0) {
|
|
|
|
|
order1.setOrderStatus("3");//3是满足出库数量
|
|
|
|
|
} else {
|
|
|
|
|
order1.setOrderStatus("2");
|
|
|
|
|
}
|
|
|
|
|
order1.setOutNumber(tem);//这样的话,就可以用已经过账的数量来计算要过账的数量,用出库数量减去已经过账的数量,就是要过账的数量,只要不为0,就可以进行
|
|
|
|
|
|
|
|
|
|
// order1.setSapNumber(sapNumber.add(planNumber));//原本的过账数量
|
|
|
|
|
odsProcureOutOrderMapper.updateWmsOdsProcureOutOrder(order1);//订单修改--会超
|
|
|
|
|
//明细
|
|
|
|
|
odsProcureOutOrderMapper.updateWmsOdsProcureOutOrder(order1);//订单修改--会超
|
|
|
|
|
//明细
|
|
|
|
|
// BigDecimal temk= wmsOdsMateStorageNewsSn.getAmount().subtract(amount);
|
|
|
|
|
wmsOdsMateStorageNewsSn.setOutNumber(amount);
|
|
|
|
|
wmsOdsMateStorageNewsSn.setLastModifiedBy(createBy);
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSnAddoutNumber(wmsOdsMateStorageNewsSn);//库存明细--包材库存
|
|
|
|
|
WmsOdsEmStorageNews wmsOdsEmStorageNews = new WmsOdsEmStorageNews();
|
|
|
|
|
wmsOdsEmStorageNews.setWhCode(wmsOdsMateStorageNewsSn.getWhCode());//仓库编码
|
|
|
|
|
wmsOdsEmStorageNews.setWlCode(wmsOdsMateStorageNewsSn.getWlCode());//库位编码
|
|
|
|
|
wmsOdsEmStorageNews.setWaCode(wmsOdsMateStorageNewsSn.getWaCode());
|
|
|
|
|
wmsOdsEmStorageNews.setProductBatch(wmsOdsMateStorageNewsSn.getUserDefined2());
|
|
|
|
|
wmsOdsEmStorageNews.setMaterialCode(wmsOdsMateStorageNewsSn.getMaterialCode());
|
|
|
|
|
wmsOdsEmStorageNews.setAmount(odsProcureOutOrder.getPlanNumber());//库存
|
|
|
|
|
wmsOdsEmStorageNews.setLastModifiedBy(createBy);
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatekdd(wmsOdsEmStorageNews);//库存调整
|
|
|
|
|
wmsOdsMateStorageNewsSn.setOutNumber(amount);
|
|
|
|
|
wmsOdsMateStorageNewsSn.setLastModifiedBy(createBy);
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSnAddoutNumber(wmsOdsMateStorageNewsSn);//库存明细--包材库存
|
|
|
|
|
WmsOdsEmStorageNews wmsOdsEmStorageNews = new WmsOdsEmStorageNews();
|
|
|
|
|
wmsOdsEmStorageNews.setWhCode(wmsOdsMateStorageNewsSn.getWhCode());//仓库编码
|
|
|
|
|
wmsOdsEmStorageNews.setWlCode(wmsOdsMateStorageNewsSn.getWlCode());//库位编码
|
|
|
|
|
wmsOdsEmStorageNews.setWaCode(wmsOdsMateStorageNewsSn.getWaCode());
|
|
|
|
|
wmsOdsEmStorageNews.setProductBatch(wmsOdsMateStorageNewsSn.getUserDefined2());
|
|
|
|
|
wmsOdsEmStorageNews.setMaterialCode(wmsOdsMateStorageNewsSn.getMaterialCode());
|
|
|
|
|
wmsOdsEmStorageNews.setAmount(odsProcureOutOrder.getPlanNumber());//库存
|
|
|
|
|
wmsOdsEmStorageNews.setLastModifiedBy(createBy);
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatekdd(wmsOdsEmStorageNews);//库存调整
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
OdsProcureOutOrder order=new OdsProcureOutOrder();
|
|
|
|
|
|
|
|
|
|
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByOrderStatus(order);
|
|
|
|
@ -2550,6 +2553,10 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
OutboundPostingzcSAPGY(orderList1);
|
|
|
|
|
}
|
|
|
|
|
if (gzList.size()>0) {
|
|
|
|
|
for (OdsProcureOutOrder order1:
|
|
|
|
|
gzList) {
|
|
|
|
|
System.out.print("---------"+order1.getID());
|
|
|
|
|
}
|
|
|
|
|
OutboundPostingzcSAPGY(gzList);
|
|
|
|
|
// List<OdsProcureOutOrder> odsProcureOutOrders = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByIDs(gzList);
|
|
|
|
|
// if (odsProcureOutOrders.size()>0){
|
|
|
|
|