@@ -22,6 +22,11 @@ import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.basedata_manage.service.dao.Structattr ;
import org.nl.wms.ext_manage.service.MesToWmsService ;
import org.nl.wms.ext_manage.service.dto.* ;
import org.nl.wms.pm_manage.demand.service.IMaterialWarehouseMappingService ;
import org.nl.wms.pm_manage.demand.service.IPartDemandService ;
import org.nl.wms.pm_manage.demand.service.dao.MaterialWarehouseMapping ;
import org.nl.wms.pm_manage.demand.service.dao.PartDemand ;
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus ;
import org.nl.wms.sch_manage.service.ISchBasePointService ;
import org.nl.wms.sch_manage.service.ISchBaseRegionService ;
import org.nl.wms.sch_manage.service.core.tasks.LineCallFullTask ;
@@ -94,6 +99,10 @@ public class MesToWmsServiceImpl implements MesToWmsService {
private IOStorInvDisMapper ioStorInvDisMapper ;
@Autowired
private IStInventoryService iStInventoryService ;
@Autowired
private IMaterialWarehouseMappingService materialWarehouseMappingService ;
@Autowired
private IPartDemandService partDemandService ;
@Transactional
@@ -272,6 +281,8 @@ public class MesToWmsServiceImpl implements MesToWmsService {
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , item . getItem_id ( ) ) ;
entry . put ( " qty " , param . getLoadQty ( ) ) ; //喷涂线边
entry . put ( " warehouseno " , storCode ) ;
entry . put ( " materialno " , item . getMaterial_code ( ) ) ;
entrysOut . add ( entry ) ;
break ;
}
@@ -293,136 +304,27 @@ public class MesToWmsServiceImpl implements MesToWmsService {
@Override
public void assemblyOffline ( AssemblyOfflineDto assemblyOfflineDto ) {
//部装下线
String storeCode = RegionConstant . ASSEMBLY_PART_STORE_CODE ; //部装半成品库
String orderCode = assemblyOfflineDto . getOrderCode ( ) ;
MaterialWarehouseMapping materialWarehouseMapping = new MaterialWarehouseMapping ( ) ;
materialWarehouseMapping . setMaterialCode ( assemblyOfflineDto . getMaterialCode ( ) ) ;
materialWarehouseMapping . setWarehouseCode ( storeCode ) ;
materialWarehouseMappingService . saveOrUpdateMapping ( materialWarehouseMapping ) ;
WorkOrderDao workOrder = workOrderService . getOne ( new LambdaQueryWrapper < WorkOrderDao > ( )
. eq ( WorkOrderDao : : getOrder_code , orderCode ) ) ;
if ( workOrder = = null ) {
throw new BadRequestException ( " WMS不存在工单: " + orderCode ) ;
}
// List<WorkOrderBomDao> orderBomItems = workOrderService.getOrderBomItem(orderCode);
// BsrealStorattr storattrOut = storattrService.findByCode(storCode);//喷涂半成品库
// Structattr structattrOut = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
// .eq(Structattr::getSect_code, storCode)
// .last("limit 1"));
final String now = DateUtil . now ( ) ;
int seq = 1 ;
String currentUserId = SecurityUtils . getCurrentUserId ( ) ;
String nickName = SecurityUtils . getCurrentNickName ( ) ;
// IOStorInv ioStorInvOut = new IOStorInv();
// ioStorInvOut.setIostorinv_id(IdUtil.getStringId());
// ioStorInvOut.setBill_code(CodeUtil.getNewCode("OUT_STORE_CODE"));
// ioStorInvOut.setIo_type(IOSEnum.IO_TYPE.code("出库"));
// ioStorInvOut.setBill_type(IOSEnum.BILL_TYPE.code("生产出库"));
// ioStorInvOut.setBiz_date(DateUtil.today());
// ioStorInvOut.setStor_code(storattrOut.getStor_code());
// ioStorInvOut.setStor_name(storattrOut.getStor_name());
// ioStorInvOut.setStor_id(storattrOut.getStor_id());
// ioStorInvOut.setDetail_count((int) orderBomItems.stream().filter(i -> storCode.equals(i.getWarehouse_code())).count());
// ioStorInvOut.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
// ioStorInvOut.setCreate_mode(IOSEnum.CREATE_MODE.code("外部接口产生"));
// ioStorInvOut.setInput_optid(currentUserId);
// ioStorInvOut.setInput_optname(nickName);
// ioStorInvOut.setInput_time(now);
// ioStorInvOut.setIs_delete(BaseDataEnum.IS_YES_NOT.code("否"));
// ioStorInvOut.setIs_upload(BaseDataEnum.IS_YES_NOT.code("是"));
final List < IOStorInvDtl > ioStorInvDtls = new ArrayList < > ( ) ;
final List < IOStorInvDis > iOStorInvDiss = new ArrayList < > ( ) ;
// List<OutFinishParam> outFinsParams = new ArrayList<>() ;
// for (WorkOrderBomDao bomItem : orderBomItems) {
// if (!Objects.equals(bomItem.getWarehouse_code(), storCode)){
// continue;//跳过非喷涂半成品库物料
// }
// BigDecimal qty = bomItem.getBom_qty();
// final String materialCode = bomItem.getMaterial_code();
// MdMeMaterialbase material = iMdMeMaterialbaseService.getByCode(materialCode);
// final IOStorInvDtl ioStorInvDtl = new IOStorInvDtl();
// ioStorInvDtl.setIostorinv_id(ioStorInvOut.getIostorinv_id());
// ioStorInvDtl.setIostorinvdtl_id(IdUtil.getStringId());
// ioStorInvDtl.setSeq_no(String.valueOf(seq));
// ioStorInvDtl.setMaterial_code(materialCode);
// ioStorInvDtl.setMaterial_id(material.getMaterial_id());
// ioStorInvDtl.setQty_unit_id(material.getQty_unit_id());
// ioStorInvDtl.setQty_unit_name(material.getQty_unit_name());
// ioStorInvDtl.setPcsn("1");
// ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
// ioStorInvDtl.setAssign_qty(qty);
// ioStorInvDtl.setPlan_qty(qty);
// ioStorInvDtl.setUnassign_qty(BigDecimal.ZERO);
// ioStorInvDtl.setSource_bill_code(orderCode);
// ioStorInvDtl.setSource_bill_type("work_order");
// ioStorInvDtls.add(ioStorInvDtl);
// // 分配
// final IOStorInvDis ioStorInvDis = new IOStorInvDis();
// ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
// ioStorInvDis.setIostorinv_id(ioStorInvOut.getIostorinv_id()); // 修正变量名
// ioStorInvDis.setIostorinvdtl_id(ioStorInvDtl.getIostorinvdtl_id()); // 从对象获取,而不是从 JSON
// ioStorInvDis.setSeq_no("1"); // 直接用 int, 不需要 String
// ioStorInvDis.setMaterial_id(material.getMaterial_id());
// ioStorInvDis.setMaterial_code(materialCode); // 直接使用变量
// ioStorInvDis.setSect_code(bomItem.getWarehouse_code());
// ioStorInvDis.setStruct_code(structattrOut.getStruct_code());
// ioStorInvDis.setPcsn("1");
// ioStorInvDis.setStoragevehicle_code(structattrOut.getStoragevehicle_code());
// ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("完成"));
// ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
// ioStorInvDis.setQty_unit_id(material.getQty_unit_id());
// ioStorInvDis.setQty_unit_name(material.getQty_unit_name());
// ioStorInvDis.setPlan_qty(qty); // 直接使用 qty 变量
// ioStorInvDis.setReal_qty(qty);
// iOStorInvDiss.add(ioStorInvDis);
// //更新组盘记录表
// outFinsParams.add(OutFinishParam.builder()
// .storagevehicleCode(structattrOut.getStoragevehicle_code())
// .changeQty(qty)
// .sectCode(bomItem.getWarehouse_code())
// .structCode(structattrOut.getStruct_code())
// .materialCode(materialCode)
// .build());
// }
// ioStorInvMapper.insert(ioStorInvOut);
// ioStorInvDtlMapper.batchInsert(ioStorInvDtls);
// ioStorInvDisMapper.batchSave(iOStorInvDiss);
// iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
// //保存领料出库回传单定时回传
// JSONObject callbackOutData = new JSONObject();
// callbackOutData.put("method", "DealLLCKBill");
// callbackOutData.put("type", "MES");
// // 组装data节点
// JSONObject dataOut = new JSONObject();
// dataOut.put("orgno", workOrder.getOrg_code());//库存组织
// dataOut.put("billno", workOrder.getOrder_code()); // 单据编号
// dataOut.put("biztype", "340");
// dataOut.put("invscheme", "002");
// dataOut.put("transtype", "020");
// dataOut.put("biztime", LocalDate.now());
// dataOut.put("cztype", "02");
// JSONArray entrysOut = new JSONArray();
// for (WorkOrderBomDao item : orderBomItems) {
// if (!Objects.equals(item.getWarehouse_code(), storCode)){
// continue;//跳过非喷涂半成品库物料
// }
// JSONObject entry = new JSONObject();
// entry.put("srcbillno", orderCode);
// entry.put("srcbillid", workOrder.getOrder_id()); // 数量
// entry.put("srcbillentryid", item.getItem_id());
// entry.put("qty", item.getBom_qty());//喷涂线边
// entrysOut.add(entry);
// }
// dataOut.put("entrys", entrysOut);
// callbackOutData.put("data", dataOut);
// PmStockReturn stockReturnOut = new PmStockReturn();
// stockReturnOut.setRequest_Id(orderCode);
// stockReturnOut.setRequest_type(IOSEnum.BILL_TYPE.code("生产出库"));
// stockReturnOut.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
// stockReturnOut.setCreate_time(now);
// stockReturnOut.setRequest_data(callbackOutData.toString());
// iPmStockReturnService.save(stockReturnOut);
BsrealStorattr storattrIn = storattrService . findByCode ( workOrder . getDefault_warehouse_code ( ) ) ;
BsrealStorattr storattrIn = storattrService . findByCode ( storeCode ) ;
Structattr structattrIn = iStructattrService . getOne ( new LambdaQueryWrapper < Structattr > ( )
. eq ( Structattr : : getSect_code , workOrder . getDefault_warehouse_code ( ) )
. eq ( Structattr : : getSect_code , storeCode )
. last ( " limit 1 " ) ) ; //部装半成品库
// ioStorInvDtls.clear();
// iOStorInvDiss.clear();
//生成入库单
IOStorInv ioStorInvIn = new IOStorInv ( ) ;
ioStorInvIn . setIostorinv_id ( IdUtil . getStringId ( ) ) ;
@@ -468,7 +370,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
ioStorInvDis . setSeq_no ( " 1 " ) ; // 直接用 int, 不需要 String
ioStorInvDis . setMaterial_id ( material . getMaterial_id ( ) ) ;
ioStorInvDis . setMaterial_code ( materialCode ) ; // 直接使用变量
ioStorInvDis . setSect_code ( workOrder . getDefault_warehouse_code ( ) ) ;
ioStorInvDis . setSect_code ( storeCode ) ;
ioStorInvDis . setStruct_code ( structattrIn . getStruct_code ( ) ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setStoragevehicle_code ( structattrIn . getStoragevehicle_code ( ) ) ;
@@ -522,6 +424,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , workOrder . getOrder_id ( ) ) ;
entry . put ( " qty " , workOrder . getOrder_qty ( ) ) ;
entry . put ( " warehouseno " , storeCode ) ;
entrysIn . add ( entry ) ;
dataIn . put ( " entrys " , entrysIn ) ;
callbackInData . put ( " data " , dataIn ) ;
@@ -575,8 +478,9 @@ public class MesToWmsServiceImpl implements MesToWmsService {
final List < IOStorInvDtl > ioStorInvDtls = new ArrayList < > ( ) ;
final List < IOStorInvDis > iOStorInvDiss = new ArrayList < > ( ) ;
List < OutFinishParam > outFinsParams = new ArrayList < > ( ) ;
JSONArray entrysOut = new JSONArray ( ) ;
for ( WorkOrderBomDao bomItem : orderBomItems ) {
if ( ! Objects . equals ( bomItem . getWarehouse_code ( ) , storCode1 ) ) {
if ( ! Objects . equals ( materialWarehouseMappingService . getOrDefault ( bomItem . getMaterial_code ( ) , bomItem. getWarehouse_code ( ) ) , storCode1 ) ) {
continue ; //跳过非部装半成品库物料
}
BigDecimal qty = bomItem . getBom_qty ( ) ;
@@ -625,144 +529,65 @@ public class MesToWmsServiceImpl implements MesToWmsService {
. structCode ( structattrOut . getStruct_code ( ) )
. materialCode ( materialCode )
. build ( ) ) ;
JSONObject entry = new JSONObject ( ) ;
entry . put ( " srcbillno " , orderCode ) ;
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , bomItem . getItem_id ( ) ) ;
entry . put ( " qty " , bomItem . getBom_qty ( ) ) ; //喷涂线边
entry . put ( " warehouseno " , storCode1 ) ;
entry . put ( " materialno " , bomItem . getMaterial_code ( ) ) ;
entrysOut . add ( entry ) ;
//完成部装半成品库需求单
PartDemand partDemand = partDemandService . getOne ( new LambdaQueryWrapper < PartDemand > ( )
. eq ( PartDemand : : getSku_code , materialCode )
. like ( PartDemand : : getWork_order_code , workOrder . getOrder_code ( ) )
. last ( " limit 1 " ) ) ;
partDemand . setAssign_qty ( partDemand . getAssign_qty ( ) . add ( bomItem . getBom_qty ( ) ) ) ;
if ( partDemand . getAssign_qty ( ) . compareTo ( partDemand . getQty ( ) ) > = 0 ) {
partDemand . setStatus ( DemandStatus . FINISH . getValue ( ) ) ;
} else {
partDemand . setStatus ( DemandStatus . RUN . getValue ( ) ) ;
}
partDemandService . updateById ( partDemand ) ;
}
ioStorInvMapper . insert ( ioStorInvOut ) ;
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
iStInventoryService . changeInventory ( InventoryChangeType . OUT_FINS , outFinsParams ) ;
BsrealStorattr storattrIn = storattrService . findByCode ( storCode2 ) ; //装配线边 库
Structattr structattrIn = iStructattrService . getOne ( new LambdaQueryWrapper < Structattr > ( )
. eq ( Structattr : : getSect_code , storCode2 )
. las t( " limit 1 " ) ) ; //喷涂半成品库
ioStorInvDtls . clear ( ) ;
iOStorInvDiss . clear ( ) ;
//生成入库单
IOStorInv ioStorInvIn = new IOStorInv ( ) ;
ioStorInvIn . setIostorinv_id ( IdUtil . getStringId ( ) ) ;
ioStorInvIn . setBill_code ( CodeUtil . getNewCode ( " IN_STORE_CODE " ) ) ;
ioStorInvIn . setIo_type ( IOSEnum . IO_TYPE . code ( " 入库 " ) ) ;
ioStorInvIn . setBill_type ( IOSEnum . BILL_TYPE . code ( " 生产入库 " ) ) ;
ioStorInvIn . setBiz_date ( DateUtil . today ( ) ) ;
ioStorInvIn . setStor_code ( storattrIn . getStor_code ( ) ) ;
ioStorInvIn . setStor_name ( storattrIn . getStor_name ( ) ) ;
ioStorInvIn . setStor_id ( storattrIn . getStor_id ( ) ) ;
ioStorInvIn . setDetail_count ( 1 ) ;
ioStorInvIn . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvIn . setCreate_mode ( IOSEnum . CREATE_MODE . code ( " 外部接口产生 " ) ) ;
ioStorInvIn . setInput_optid ( currentUserId ) ;
ioStorInvIn . setInput_optname ( nickName ) ;
ioStorInvIn . setInput_time ( now ) ;
ioStorInvIn . setIs_delete ( BaseDataEnum . IS_YES_NOT . code ( " 否 " ) ) ;
ioStorInvIn . setIs_upload ( BaseDataEnum . IS_YES_NOT . code ( " 是 " ) ) ;
List < AddInvParam > addInvParams = new ArrayList < > ( ) ;
List < InFinishParam > inFinishParams = new ArrayList < > ( ) ;
JSONArray entrys = new JSONArray ( ) ;
for ( WorkOrderBomDao item : orderBomItems ) {
if ( ! Objects . equals ( item . getWarehouse_code ( ) , storCode1 ) ) {
continue ; //跳过非部装半成品库物料
}
final String materialCode = item . getMaterial_code ( ) ;
BigDecimal qty = item . getBom_qty ( ) ;
MdMeMaterialbase material = iMdMeMaterialbaseService . getByCode ( materialCode ) ;
final IOStorInvDtl ioStorInvDtl = new IOStorInvDtl ( ) ;
ioStorInvDtl . setIostorinv_id ( ioStorInvIn . getIostorinv_id ( ) ) ;
ioStorInvDtl . setIostorinvdtl_id ( IdUtil . getStringId ( ) ) ;
ioStorInvDtl . setSeq_no ( String . valueOf ( seq ) ) ;
ioStorInvDtl . setMaterial_code ( materialCode ) ;
ioStorInvDtl . setMaterial_id ( material . getMaterial_id ( ) ) ;
ioStorInvDtl . setQty_unit_id ( material . getQty_unit_id ( ) ) ;
ioStorInvDtl . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDtl . setPcsn ( " 1 " ) ;
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvDtl . setAssign_qty ( qty ) ;
ioStorInvDtl . setPlan_qty ( qty ) ;
ioStorInvDtl . setUnassign_qty ( BigDecimal . ZERO ) ;
ioStorInvDtl . setSource_bill_code ( orderCode ) ;
ioStorInvDtl . setSource_bill_type ( " work_order " ) ;
ioStorInvDtls . add ( ioStorInvDtl ) ;
// 分配
final IOStorInvDis ioStorInvDis = new IOStorInvDis ( ) ;
ioStorInvDis . setIostorinvdis_id ( IdUtil . getStringId ( ) ) ;
ioStorInvDis . setIostorinv_id ( ioStorInvIn . getIostorinv_id ( ) ) ; // 修正变量名
ioStorInvDis . setIostorinvdtl_id ( ioStorInvDtl . getIostorinvdtl_id ( ) ) ; // 从对象获取,而不是从 JSON
ioStorInvDis . setSeq_no ( " 1 " ) ; // 直接用 int, 不需要 String
ioStorInvDis . setMaterial_id ( material . getMaterial_id ( ) ) ;
ioStorInvDis . setMaterial_code ( materialCode ) ; // 直接使用变量
ioStorInvDis . setSect_code ( storCode2 ) ;
ioStorInvDis . setStruct_code ( structattrIn . getStruct_code ( ) ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setStoragevehicle_code ( structattrIn . getStoragevehicle_code ( ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( " 是 " ) ) ;
ioStorInvDis . setQty_unit_id ( material . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDis . setPlan_qty ( qty ) ; // 直接使用 qty 变量
ioStorInvDis . setReal_qty ( qty ) ;
iOStorInvDiss . add ( ioStorInvDis ) ;
AddInvParam addParam = new AddInvParam ( ) ;
addParam . setPcsn ( " 1 " ) ;
addParam . setMaterialCode ( materialCode ) ;
addParam . setStoragevehicleCode ( structattrIn . getStoragevehicle_code ( ) ) ;
addParam . setUnitName ( material . getQty_unit_name ( ) ) ;
addParam . setUnitId ( material . getQty_unit_id ( ) ) ;
addParam . setQty ( qty ) ;
addInvParams . add ( addParam ) ;
InFinishParam inFinishParam = new InFinishParam ( ) ;
inFinishParam . setPcsn ( " 1 " ) ;
inFinishParam . setMaterialCode ( materialCode ) ;
inFinishParam . setStoragevehicleCode ( structattrIn . getStoragevehicle_code ( ) ) ;
inFinishParam . setUnitName ( material . getQty_unit_name ( ) ) ;
inFinishParam . setUnitId ( material . getQty_unit_id ( ) ) ;
inFinishParam . setQty ( qty ) ;
inFinishParam . setSectCode ( structattrIn . getSect_code ( ) ) ;
inFinishParam . setStructCode ( structattrIn . getStruct_code ( ) ) ;
inFinishParams . add ( inFinishParam ) ;
JSONObject entry = new JSONObject ( ) ;
entry . put ( " unitNo " , " PCS " ) ;
entry . put ( " qty " , loadMatDto . getLoadQty ( ) ) ; // 数量
entry . put ( " materialNo " , materialCode ) ;
entry . put ( " trackNo " , item . getTrack_no ( ) ) ;
entry . put ( " issueWarehouseNo " , storCode1 ) ; //部装半成品库
entry . put ( " receiptWarehouseNo " , storCode2 ) ; //到装配线边
entrys . add ( entry ) ;
}
ioStorInvMapper . insert ( ioStorInvIn ) ;
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
iStInventoryService . changeInventory ( InventoryChangeType . ADD_INV , addInvParams ) ;
iStInventoryService . changeInventory ( InventoryChangeType . IN_FINISH , inFinishParams ) ;
JSONObject callbackData = new JSONObject ( ) ;
callbackData . put ( " method " , " DealLLDBBill " ) ;
callbackData . put ( " type " , " WMS " ) ;
//部装件领料出 库
JSONObject callbackOutData = new JSONObject ( ) ;
callbackOutData . put ( " method " , " DealLLCKBill " ) ;
callbackOutData . pu t( " type " , " MES " ) ;
// 组装data节点
JSONObject data = new JSONObject ( ) ;
data . put ( " issueStorageOrgUnitNo " , " 01.09.14 " ) ;
data . put ( " bizTypeN o " , " 331 " ) ; // 业务日期
data . put ( " receiptStorageOrgUnitNo " , " 01.09.14 " ) ;
data . put ( " billNo " , orderCode ) ; // 使用工单编号作为MES单号
data . put ( " entrys " , entrys ) ;
callbackData . put ( " data " , data ) ;
PmStockReturn stockReturn = new PmStockReturn ( ) ;
s tockReturn. setRequest_Id ( orderCode ) ;
stockReturn . setRequest_type ( IOSEnum . BILL_TYPE . code ( " 库存调拨 " ) ) ;
stockReturn . setStatus ( StockReturnStatusEnum . TODO . getC ode( ) ) ; // 0-处理中
stockReturn . setCreate_tim e ( now ) ;
stockReturn . setRequest_data ( callbackData . toString ( ) ) ;
iPmS tockReturnService . save ( stockReturn ) ;
JSONObject dataOut = new JSONObject ( ) ;
dataOut . put ( " orgno " , workOrder . getOrg_code ( ) ) ; //库存组织
dataOut . put ( " billn o " , workOrder . getOrder_code ( ) ) ; // 单据编号
dataOut . put ( " biztype " , " 340 " ) ;
dataOut . put ( " invscheme " , " 002 " ) ;
dataOut . put ( " transtype " , " 020 " ) ;
dataOut . put ( " biztime " , LocalDate . now ( ) . toString ( ) ) ;
dataOut . put ( " cztype " , " 02 " ) ;
PmS tockReturn stockReturnOut = new PmStockReturn ( ) ;
stockReturnOut . setRequest_Id ( orderCode ) ;
stockReturnOut . setRequest_type ( IOSEnum . BILL_TYPE . c ode( " 生产出库 " ) ) ;
stockReturnOut . setStatus ( StockReturnStatusEnum . TODO . getCod e ( ) ) ; // 0-处理中
stockReturnOut . setCreate_time ( now ) ;
s tockReturnOut . setRequest_data ( callbackOutData . toString ( ) ) ;
iPmStockReturnService . save ( stockReturnOut ) ;
}
@Transactional
@Override
public void platingOffline ( PlatingOfflineDto param ) {
//喷涂下线 车架:喷涂半成品-> 装配线边
//喷涂下线 车架:喷涂半成品-> 装配线边 2026/10/15修改: 全部走领料出库
// 门架:从喷涂领料出库
String storCode1 = RegionConstant . PLATING_STORE_CODE ;
String storCode2 = RegionConstant . ASSEMBLY_LINE_STORE_CODE ;
String unloadPort = param . getUnloadPort ( ) ; //下件位置
String storeMapper = iSchBasePointService. getPointRegionMapperSect( unloadPort) ; //映射仓库
boolean isAllocate = ! StringUtils. isEmpty( storeMapper) ; //如果有映射仓库则调拨到线边库,没有则直接出库
// String storeMapper = iSchBasePointService. getPointRegionMapperSect( unloadPort); //映射仓库
// boolean isAllocate = ! StringUtils. isEmpty( storeMapper); //如果有映射仓库则调拨到线边库,没有则直接出库
boolean isAllocate = true ; //2026/10/15修改: 全部走领料出库
String orderCode = param . getOrderCode ( ) ;
WorkOrderDao workOrder = workOrderService . getOne ( new LambdaQueryWrapper < WorkOrderDao > ( )
. eq ( WorkOrderDao : : getOrder_code , orderCode ) ) ;
@@ -845,7 +670,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
iStInventoryService . changeInventory ( InventoryChangeType . OUT_FINS , outFinsParams ) ;
if ( ! isAllocate ) { //不需要调拨
if ( isAllocate ) { //不需要调拨
BsrealStorattr storattrIn = storattrService . findByCode ( storCode2 ) ;
Structattr structattrIn = iStructattrService . getOne ( new LambdaQueryWrapper < Structattr > ( )
. eq ( Structattr : : getSect_code , storCode2 )
@@ -981,6 +806,8 @@ public class MesToWmsServiceImpl implements MesToWmsService {
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , item . getItem_id ( ) ) ;
entry . put ( " qty " , param . getUnloadQty ( ) ) ;
entry . put ( " warehouseno " , storCode1 ) ;
entry . put ( " materialno " , item . getMaterial_code ( ) ) ;
entrysOut . add ( entry ) ;
break ;
}
@@ -1003,6 +830,11 @@ public class MesToWmsServiceImpl implements MesToWmsService {
@Override
public void platingInbound ( PlatingInboundDto param ) {
//入库喷涂半成品
String storeCode = RegionConstant . PLATING_STORE_CODE ;
MaterialWarehouseMapping materialWarehouseMapping = new MaterialWarehouseMapping ( ) ;
materialWarehouseMapping . setMaterialCode ( param . getMaterialCode ( ) ) ;
materialWarehouseMapping . setWarehouseCode ( storeCode ) ;
materialWarehouseMappingService . saveOrUpdateMapping ( materialWarehouseMapping ) ;
String orderCode = param . getOrderCode ( ) ;
if ( StringUtils . isEmpty ( orderCode ) ) {
throw new BadRequestException ( " 参数为空 " ) ;
@@ -1013,9 +845,9 @@ public class MesToWmsServiceImpl implements MesToWmsService {
throw new BadRequestException ( " WMS不存在工单: " + orderCode ) ;
}
List < WorkOrderBomDao > orderBomItems = workOrderService . getOrderBomItem ( orderCode ) ;
BsrealStorattr storattrIn = storattrService . findByCode ( workOrder . getDefault_warehouse_code ( ) ) ; //喷涂半成品库
BsrealStorattr storattrIn = storattrService . findByCode ( storeCode ) ; //喷涂半成品库
Structattr structattrIn = iStructattrService . getOne ( new LambdaQueryWrapper < Structattr > ( )
. eq ( Structattr : : getSect_code , workOrder . getDefault_warehouse_code ( ) )
. eq ( Structattr : : getSect_code , storeCode )
. last ( " limit 1 " ) ) ; //喷涂半成品库
final String now = DateUtil . now ( ) ;
int seq = 1 ;
@@ -1068,7 +900,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
ioStorInvDis . setSeq_no ( " 1 " ) ; // 直接用 int, 不需要 String
ioStorInvDis . setMaterial_id ( material . getMaterial_id ( ) ) ;
ioStorInvDis . setMaterial_code ( materialCode ) ; // 直接使用变量
ioStorInvDis . setSect_code ( workOrder . getDefault_warehouse_code ( ) ) ;
ioStorInvDis . setSect_code ( storeCode ) ;
ioStorInvDis . setStruct_code ( structattrIn . getStruct_code ( ) ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setStoragevehicle_code ( structattrIn . getStoragevehicle_code ( ) ) ;
@@ -1122,6 +954,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , workOrder . getOrder_id ( ) ) ;
entry . put ( " qty " , param . getQty ( ) ) ;
entry . put ( " warehouseno " , storeCode ) ;
entrysIn . add ( entry ) ;
dataIn . put ( " entrys " , entrysIn ) ;
callbackInData . put ( " data " , dataIn ) ;