|
|
|
@ -17,7 +17,10 @@ import java.util.List;
|
|
|
|
|
import com.op.common.core.domain.R;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.system.api.RemoteSapService;
|
|
|
|
|
import com.op.system.api.domain.sap.SapBackflushMPQuery;
|
|
|
|
|
import com.op.system.api.domain.sap.SapMaterialPosting;
|
|
|
|
|
import okhttp3.OkHttpClient;
|
|
|
|
|
import okhttp3.MediaType;
|
|
|
|
|
import okhttp3.RequestBody;
|
|
|
|
@ -53,7 +56,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
private WmsOdsMateStorageNewsMapper wmsOdsMateStorageNewsMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private OdsProcureOutOrderMapper odsProcureOutOrderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private BaseWarehouseMapper baseWarehouseMapper;
|
|
|
|
|
/**
|
|
|
|
|
* 查询包材采购单
|
|
|
|
|
*
|
|
|
|
@ -262,7 +269,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
public OrderLine addPurchaseOrderOutbound(OrderLine orderLine) {
|
|
|
|
|
//自己生成行项目,,批次号
|
|
|
|
|
List<OrderLine> orderList= orderLine.getList();
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss");
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
String formattedDate = dateFormat.format(date);
|
|
|
|
|
//根据订单号查询对应的最大批次号
|
|
|
|
@ -280,7 +287,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
orderList) {
|
|
|
|
|
OdsProcureOutOrder odsProcureOutOrder=new OdsProcureOutOrder();
|
|
|
|
|
odsProcureOutOrder.setID(IdUtils.fastSimpleUUID());
|
|
|
|
|
odsProcureOutOrder.setSiteCode(orderLine1.getSiteCode());
|
|
|
|
|
odsProcureOutOrder.setProduceCode(orderLine.getOrderNo());
|
|
|
|
|
odsProcureOutOrder.setLocCode(orderLine.getWarehouseNo());
|
|
|
|
|
odsProcureOutOrder.setMaterialCode(orderLine1.getMaterialCode());
|
|
|
|
|
odsProcureOutOrder.setMaterialDesc(orderLine1.getMaterialDesc());
|
|
|
|
|
odsProcureOutOrder.setPlanDate(new Date());
|
|
|
|
@ -291,6 +300,8 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
odsProcureOutOrder.setOrderStatus("1");
|
|
|
|
|
odsProcureOutOrder.setPlanNumber(orderLine1.getPlanNumber());
|
|
|
|
|
odsProcureOutOrder.setUserDefined2(orderLine1.getOrderLineNo());
|
|
|
|
|
odsProcureOutOrder.setUserDefined3(orderLine1.getUserDefined3());
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("1");
|
|
|
|
|
//odsProcureOutOrder.set
|
|
|
|
|
odsProcureOutOrderMapper.insertOdsProcureOutOrder(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
@ -301,7 +312,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
orderList) {
|
|
|
|
|
OdsProcureOutOrder odsProcureOutOrder=new OdsProcureOutOrder();
|
|
|
|
|
odsProcureOutOrder.setID(IdUtils.fastSimpleUUID());
|
|
|
|
|
odsProcureOutOrder.setLocCode(orderLine.getWarehouseNo());
|
|
|
|
|
odsProcureOutOrder.setProduceCode(orderLine.getOrderNo());
|
|
|
|
|
odsProcureOutOrder.setSiteCode(orderLine1.getSiteCode());
|
|
|
|
|
odsProcureOutOrder.setMaterialCode(orderLine1.getMaterialCode());
|
|
|
|
|
odsProcureOutOrder.setMaterialDesc(orderLine1.getMaterialDesc());
|
|
|
|
|
odsProcureOutOrder.setPlanDate(new Date());
|
|
|
|
@ -310,9 +323,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
odsProcureOutOrder.setUserDefined1(orderLine1.getBatchNo());
|
|
|
|
|
odsProcureOutOrder.setActive("1");
|
|
|
|
|
odsProcureOutOrder.setOrderStatus("1");
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("1");
|
|
|
|
|
odsProcureOutOrder.setPlanNumber(orderLine1.getPlanNumber());
|
|
|
|
|
odsProcureOutOrder.setUserDefined2(orderLine1.getOrderLineNo());
|
|
|
|
|
//odsProcureOutOrder.set
|
|
|
|
|
odsProcureOutOrder.setUserDefined3(orderLine1.getUserDefined3());
|
|
|
|
|
odsProcureOutOrderMapper.insertOdsProcureOutOrder(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -441,10 +456,64 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
//修改对应订单--插入对应出库托盘数据数据
|
|
|
|
|
// for (OdsProcureOutOrder odsProcureOutOrder:
|
|
|
|
|
// orderList) {
|
|
|
|
|
// //领料单,物料编号,物料名称,托盘号,出库数量,库位号,
|
|
|
|
|
// //领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
|
|
|
|
|
// odsProcureOutOrder.
|
|
|
|
|
// }
|
|
|
|
|
String factoryCode =orderList.get(0).getFactoryCode();
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" +factoryCode);
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder:
|
|
|
|
|
orderList) {
|
|
|
|
|
//领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
|
|
|
|
|
WmsToWCSDTO wcsdto =new WmsToWCSDTO();
|
|
|
|
|
|
|
|
|
|
wcsdto.setRfidNo(odsProcureOutOrder.getSn());
|
|
|
|
|
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn= wmsOdsMateStorageNewsSnMapper.selectwmsRfidNotwo(wcsdto);
|
|
|
|
|
//明细
|
|
|
|
|
//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(odsProcureOutOrder.getProduceCode());//领料单
|
|
|
|
|
order.setMaterialCode(odsProcureOutOrder.getMaterialCode());//
|
|
|
|
|
order.setMaterialDesc(odsProcureOutOrder.getMaterialDesc());
|
|
|
|
|
order.setUserDefined1(odsProcureOutOrder.getUserDefined1());//批次
|
|
|
|
|
order.setSn(odsProcureOutOrder.getSn());
|
|
|
|
|
order.setPlanNumber(odsProcureOutOrder.getPlanNumber());
|
|
|
|
|
order.setLocCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
order.setID(IdUtils.fastSimpleUUID());
|
|
|
|
|
order.setUnit(wmsOdsMateStorageNews.getUserDefined1());
|
|
|
|
|
order.setFactoryCode(factoryCode);
|
|
|
|
|
order.setActive("1");
|
|
|
|
|
order.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
order.setCreateDate(new Date());
|
|
|
|
|
odsProcureOutOrderMapper.insertWmsRawMissionOut(order);
|
|
|
|
|
|
|
|
|
|
OdsProcureOutOrder odsProcureOutOrder1= odsProcureOutOrderMapper.selectOdsProcureOutOrderByID(odsProcureOutOrder.getID());
|
|
|
|
|
BigDecimal realityNumber1 = odsProcureOutOrder1.getOutNumber();//累计数
|
|
|
|
|
BigDecimal realityNumber = odsProcureOutOrder1.getPlanNumber();//计划
|
|
|
|
|
BigDecimal planNumber =odsProcureOutOrder.getPlanNumber();
|
|
|
|
|
BigDecimal tem= realityNumber1.add(planNumber);
|
|
|
|
|
boolean isEqual = tem.equals(realityNumber);
|
|
|
|
|
if (isEqual){
|
|
|
|
|
odsProcureOutOrder1.setOrderStatus("3");
|
|
|
|
|
}else {
|
|
|
|
|
odsProcureOutOrder1.setOrderStatus("2");
|
|
|
|
|
}
|
|
|
|
|
odsProcureOutOrder1.setOutNumber(tem);
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrder(odsProcureOutOrder1);
|
|
|
|
|
WmsOdsEmStorageNews wmsOdsEmStorageNews=new WmsOdsEmStorageNews();
|
|
|
|
|
wmsOdsEmStorageNews.setWhCode(wmsOdsMateStorageNewsSn.getWhCode());//仓库编码
|
|
|
|
|
wmsOdsEmStorageNews.setWlCode(wmsOdsMateStorageNewsSn.getWlCode());//库位编码
|
|
|
|
|
wmsOdsEmStorageNews.setMaterialCode(wmsOdsMateStorageNewsSn.getMaterialCode());
|
|
|
|
|
wmsOdsEmStorageNews.setAmount(wmsOdsMateStorageNewsSn.getAmount());//库存
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatekdd(wmsOdsEmStorageNews);//库存调整
|
|
|
|
|
wmsOdsMateStorageNewsSn.setUserDefined1("1");
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSn(wmsOdsMateStorageNewsSn);//库存明细
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -457,6 +526,70 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
return wmsOdsMateStorageNewsSn1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public void OutboundPostingSAP(List<OdsProcureOutOrder> orderList) {
|
|
|
|
|
|
|
|
|
|
// * 退料的移动类型为 262
|
|
|
|
|
// * 领料的移动类型为 261
|
|
|
|
|
List<OdsProcureOutOrder> orderList1=odsProcureOutOrderMapper.selectOdsProcureOutOrderListByIds(orderList);
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder:
|
|
|
|
|
orderList1) {
|
|
|
|
|
//取sap仓库号
|
|
|
|
|
if ("X".equals(odsProcureOutOrder.getUserDefined3())){
|
|
|
|
|
List<SapBackflushMPQuery> sapBackflushMPQueryList=new ArrayList<>();
|
|
|
|
|
SapBackflushMPQuery sapBackflushMPQuery=new SapBackflushMPQuery();
|
|
|
|
|
sapBackflushMPQuery.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
|
|
|
|
|
String lgort= baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
sapBackflushMPQuery.setLgort(lgort);//库存地点
|
|
|
|
|
sapBackflushMPQuery.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
|
|
|
|
|
sapBackflushMPQuery.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
|
|
|
|
|
sapBackflushMPQuery.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
|
|
|
|
|
sapBackflushMPQuery.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
|
|
|
|
|
sapBackflushMPQueryList.add(sapBackflushMPQuery);
|
|
|
|
|
R result2= remoteSapService.sapBackflushMP(sapBackflushMPQueryList);//x
|
|
|
|
|
int code= result2.getCode();
|
|
|
|
|
String msg= result2.getMsg();
|
|
|
|
|
odsProcureOutOrder.setUserDefined11(msg);
|
|
|
|
|
if (code==200){//过账成功
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
|
|
|
|
|
}else {//
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
List<SapMaterialPosting> sapMaterialPostingList=new ArrayList<>();
|
|
|
|
|
SapMaterialPosting sapMaterialPosting =new SapMaterialPosting();
|
|
|
|
|
sapMaterialPosting.setAufnr(odsProcureOutOrder.getProduceCode());//订单号
|
|
|
|
|
sapMaterialPosting.setBwart("261"); //移动类型
|
|
|
|
|
sapMaterialPosting.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
|
|
|
|
|
String lgort= baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
sapMaterialPosting.setLgort(lgort);//库存地点
|
|
|
|
|
sapMaterialPosting.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
|
|
|
|
|
sapMaterialPosting.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
|
|
|
|
|
sapMaterialPosting.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
|
|
|
|
|
sapMaterialPosting.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
|
|
|
|
|
sapMaterialPostingList.add(sapMaterialPosting);
|
|
|
|
|
R result= remoteSapService.sapMaterialPosting(sapMaterialPostingList);
|
|
|
|
|
int code= result.getCode();
|
|
|
|
|
String msg= result.getMsg();
|
|
|
|
|
odsProcureOutOrder.setUserDefined11(msg);
|
|
|
|
|
if (code==200){//过账成功
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
|
|
|
|
|
}else {//
|
|
|
|
|
odsProcureOutOrder.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String DesignatedPalletOutboundWCS(WMSDesignatedPalle wmsDesignatedPalle){
|
|
|
|
|
// 定义请求的URL地址
|
|
|
|
|
String url = "http://192.168.202.37:9001/api/v1/ReceiveMesMsg/packingMaterialsOutBoundByPallet";
|
|
|
|
|