@@ -159,12 +159,10 @@ public class MesToWmsServiceImpl implements MesToWmsService {
@Transactional
@Override
public void confirmWorkOrder ( JSONObject param ) {
public void confirmWorkOrder ( LoadMatDto param ) {
//焊接件从焊接半成品出库
String orde rCode = param . getString ( " orderCode " ) ;
if ( StringUtils . isEmpty ( o rderCode) ) {
throw new BadRequestException ( " 参数为空 " ) ;
}
String sto rCode = " 6.004 " ;
String orderCode = param . getO rderCode( ) ;
WorkOrderDao workOrder = workOrderService . getOne ( new LambdaQueryWrapper < WorkOrderDao > ( )
. eq ( WorkOrderDao : : getOrder_code , orderCode ) ) ;
if ( workOrder = = null ) {
@@ -189,7 +187,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
ioStorInvOut . setStor_code ( storattrOut . getStor_code ( ) ) ;
ioStorInvOut . setStor_name ( storattrOut . getStor_name ( ) ) ;
ioStorInvOut . setStor_id ( storattrOut . getStor_id ( ) ) ;
ioStorInvOut . setDetail_count ( orderBomItems . size ( ) ) ;
ioStorInvOut . setDetail_count ( 1 ) ;
ioStorInvOut . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvOut . setCreate_mode ( IOSEnum . CREATE_MODE . code ( " 外部接口产生 " ) ) ;
ioStorInvOut . setInput_optid ( currentUserId ) ;
@@ -200,9 +198,8 @@ public class MesToWmsServiceImpl implements MesToWmsService {
final List < IOStorInvDtl > ioStorInvDtls = new ArrayList < > ( ) ;
final List < IOStorInvDis > iOStorInvDiss = new ArrayList < > ( ) ;
List < OutFinishParam > outFinsParams = new ArrayList < > ( ) ;
for ( WorkOrderBomDao bomItem : orderBomItems ) {
BigDecimal qty = bomIte m. getBom_qty ( ) ;
final String materialCode = bomItem . getMaterial_code ( ) ;
BigDecimal qty = param . getLoadQty ( ) ;
final String materialCode = para m. getMaterialCode ( ) ;
MdMeMaterialbase material = iMdMeMaterialbaseService . getByCode ( materialCode ) ;
final IOStorInvDtl ioStorInvDtl = new IOStorInvDtl ( ) ;
ioStorInvDtl . setIostorinv_id ( ioStorInvOut . getIostorinv_id ( ) ) ;
@@ -228,7 +225,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 ( bomItem . getWarehouse_code ( ) ) ;
ioStorInvDis . setSect_code ( storCode ) ;
ioStorInvDis . setStruct_code ( structattrOut . getStruct_code ( ) ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setStoragevehicle_code ( structattrOut . getStoragevehicle_code ( ) ) ;
@@ -243,11 +240,10 @@ public class MesToWmsServiceImpl implements MesToWmsService {
outFinsParams . add ( OutFinishParam . builder ( )
. storagevehicleCode ( structattrOut . getStoragevehicle_code ( ) )
. changeQty ( qty )
. sectCode ( bomItem . getWarehouse_code ( ) )
. sectCode ( storCode )
. structCode ( structattrOut . getStruct_code ( ) )
. materialCode ( materialCode )
. build ( ) ) ;
}
ioStorInvMapper . insert ( ioStorInvOut ) ;
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
@@ -267,13 +263,16 @@ public class MesToWmsServiceImpl implements MesToWmsService {
dataOut . put ( " cztype " , " 02 " ) ;
JSONArray entrysOut = new JSONArray ( ) ;
for ( WorkOrderBomDao item : orderBomItems ) {
if ( Objects . equals ( item . getMaterial_code ( ) , param . getMaterialCode ( ) ) ) {
JSONObject entry = new JSONObject ( ) ;
entry . put ( " srcbillno " , orderCode ) ;
entry . put ( " srcbillid " , workOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillentryid " , item . getItem_id ( ) ) ;
entry . put ( " qty " , ite m. getBom_q ty ( ) ) ; //喷涂线边
entry . put ( " qty " , para m. getLoadQ ty ( ) ) ; //喷涂线边
entrysOut . add ( entry ) ;
}
}
dataOut . put ( " entrys " , entrysOut ) ;
callbackOutData . put ( " data " , dataOut ) ;
PmStockReturn stockReturnOut = new PmStockReturn ( ) ;