@@ -159,12 +159,10 @@ public class MesToWmsServiceImpl implements MesToWmsService {
@Transactional
@Transactional
@Override
@Override
public void confirmWorkOrder ( JSONObject param ) {
public void confirmWorkOrder ( LoadMatDto param ) {
//焊接件从焊接半成品出库
//焊接件从焊接半成品出库
String orde rCode = param . getString ( " orderCode " ) ;
String sto rCode = " 6.004 " ;
if ( StringUtils . isEmpty ( o rderCode) ) {
String orderCode = param . getO rderCode( ) ;
throw new BadRequestException ( " 参数为空 " ) ;
}
WorkOrderDao workOrder = workOrderService . getOne ( new LambdaQueryWrapper < WorkOrderDao > ( )
WorkOrderDao workOrder = workOrderService . getOne ( new LambdaQueryWrapper < WorkOrderDao > ( )
. eq ( WorkOrderDao : : getOrder_code , orderCode ) ) ;
. eq ( WorkOrderDao : : getOrder_code , orderCode ) ) ;
if ( workOrder = = null ) {
if ( workOrder = = null ) {
@@ -189,7 +187,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
ioStorInvOut . setStor_code ( storattrOut . getStor_code ( ) ) ;
ioStorInvOut . setStor_code ( storattrOut . getStor_code ( ) ) ;
ioStorInvOut . setStor_name ( storattrOut . getStor_name ( ) ) ;
ioStorInvOut . setStor_name ( storattrOut . getStor_name ( ) ) ;
ioStorInvOut . setStor_id ( storattrOut . getStor_id ( ) ) ;
ioStorInvOut . setStor_id ( storattrOut . getStor_id ( ) ) ;
ioStorInvOut . setDetail_count ( orderBomItems . size ( ) ) ;
ioStorInvOut . setDetail_count ( 1 ) ;
ioStorInvOut . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvOut . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvOut . setCreate_mode ( IOSEnum . CREATE_MODE . code ( " 外部接口产生 " ) ) ;
ioStorInvOut . setCreate_mode ( IOSEnum . CREATE_MODE . code ( " 外部接口产生 " ) ) ;
ioStorInvOut . setInput_optid ( currentUserId ) ;
ioStorInvOut . setInput_optid ( currentUserId ) ;
@@ -200,54 +198,52 @@ public class MesToWmsServiceImpl implements MesToWmsService {
final List < IOStorInvDtl > ioStorInvDtls = new ArrayList < > ( ) ;
final List < IOStorInvDtl > ioStorInvDtls = new ArrayList < > ( ) ;
final List < IOStorInvDis > iOStorInvDiss = new ArrayList < > ( ) ;
final List < IOStorInvDis > iOStorInvDiss = new ArrayList < > ( ) ;
List < OutFinishParam > outFinsParams = new ArrayList < > ( ) ;
List < OutFinishParam > outFinsParams = new ArrayList < > ( ) ;
for ( WorkOrderBomDao bomItem : orderBomItems ) {
BigDecimal qty = param . getLoadQty ( ) ;
BigDecimal qty = bomIte m. getBom_qty ( ) ;
final String materialCode = para m. getMaterialCode ( ) ;
final String materialCode = bomItem . getM aterial_c ode( );
MdMeMaterialbase material = iMdMeMaterialbaseService . getByCode ( m aterialC ode) ;
MdMeMaterialbase material = iMdMeMaterialbaseService . getByCode ( materialCode ) ;
final IOStorInvDtl ioStorInvDtl = new IOStorInvDtl ( ) ;
final IOStorInvDtl ioStorInvDtl = new IOS torI nvDtl ( ) ;
ioStorInvDtl . setIostorinv_id ( ioStorInvOut . getIos tori nv_id ( ) ) ;
ioStorInvDtl . setIostorinv_id ( ioStorInvOut . getIostorinv_i d( ) ) ;
ioStorInvDtl . setIostorinvdtl _id ( IdUtil . getStringI d( ) ) ;
ioStorInvDtl . setIostorinvdtl_id ( IdUtil . getStringId ( ) ) ;
ioStorInvDtl . setSeq_no ( String . valueOf ( seq ) ) ;
ioStorInvDtl . setSeq_no ( String . valueOf ( seq ) ) ;
ioStorInvDtl . setMaterial_code ( materialCode ) ;
ioStorInvDtl . setMaterial_code ( materialCode ) ;
ioStorInvDtl . setMaterial_id ( material. getMaterial_id ( ) ) ;
ioStorInvDtl . setMaterial _id ( material . getMaterial _id ( ) ) ;
ioStorInvDtl . setQty_unit _id ( material . getQty_unit _id ( ) ) ;
ioStorInvDtl . setQty_unit_id ( material . getQty_unit_id ( ) ) ;
ioStorInvDtl . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDtl . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDtl . setPcsn ( " 1 " ) ;
ioStorInvDtl . setPcsn ( " 1 " ) ;
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvDtl . setBill_status ( IOSEnum . BILL_STATUS . code ( " 完成 " ) ) ;
ioStorInvDtl . setAssign_qty ( qty ) ;
ioStorInvDtl . setAssig n_qty ( qty ) ;
ioStorInvDtl . setPla n_qty ( qty ) ;
ioStorInvDtl . setPla n_qty ( qty ) ;
ioStorInvDtl . setUnassig n_qty ( BigDecimal . ZERO ) ;
ioStorInvDtl . setUnassign_qty ( BigDecimal . ZERO ) ;
ioStorInvDtl . setSource_bill_code ( orderCode ) ;
ioStorInvDtl . setSource_bill_cod e ( orderCode ) ;
ioStorInvDtl . setSource_bill_typ e ( " work_ order" ) ;
ioStorInvDtl . setSource_bill_type ( " work_order " ) ;
ioStorInvDtls . add ( ioStorInvDtl ) ;
ioStorInvDtls . add ( ioStorInvDtl ) ;
// 分配
// 分配
final IOStorInvDis ioStorInvDis = new IOStorInvDis ( ) ;
final IO StorInvDis ioS torI nvD is = new IOStorInvDis ( ) ;
io StorInvDis . setIos tori nvd is_id ( IdUtil . getStringId ( ) ) ;
ioStorInvDis . setIostorinvdis _id ( IdUtil . getStringI d( ) ) ;
ioStorInvDis . setIostorinv_id ( ioStorInvOut . getIostorinv_i d( ) ) ; // 修正变量名
ioStorInvDis . setIostorinv_id ( ioStorInvOut . getIostorinv_id ( ) ) ; // 修正变量名
ioStorInvDis . setIostorinvdtl _id ( ioStorInvDtl . getIostorinvdtl _id ( ) ) ; // 从对象获取,而不是从 JSON
ioStorInvDis . setIostorinvdtl_id ( ioStorInvDtl . getIostorinvdtl_id ( ) ) ; // 从对象获取,而不是从 JSON
ioStorInvDis . setSeq_no ( " 1 " ) ; // 直接用 int, 不需要 String
ioStorInvDis . setSeq_no ( " 1 " ) ; // 直接用 int, 不需要 String
ioStorInvDis . setMaterial_id ( material . getMaterial_id ( ) ) ;
ioStorInvDis . setMaterial_id ( material. getMaterial_id ( ) ) ;
ioStorInvDis . setMaterial_code ( materialCode ) ; // 直接使用变量
ioStorInvDis . setMaterial _code ( material Code) ; // 直接使用变量
ioStorInvDis . setSect _code ( stor Code) ;
ioStorInvDis . setSe ct_code ( bomItem . getWarehouse _code( ) ) ;
ioStorInvDis . setStru ct_code ( structattrOut . getStruct _code( ) ) ;
ioStorInvDis . setStruct_code ( structattrOut . getStruct_code ( ) ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setPcsn ( " 1 " ) ;
ioStorInvDis . setStoragevehicle_code ( structattrOut . getStoragevehicle_code ( ) ) ;
ioStorInvDis . setStoragevehicle_code ( structattrOut . getStoragevehicle_code ( ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) ) ;
ioStorInvDis . setWork_status ( IOSEnum . INBILL_DIS_STATUS . code ( " 完成 " ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( " 是 " ) ) ;
ioStorInvDis . setIs_issued ( BaseDataEnum . IS_YES_NOT . code ( " 是 " ) ) ;
ioStorInvDis . setQty_unit_id ( material . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_id ( material . getQty_unit_id ( ) ) ;
ioStorInvDis . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDis . setQty_unit_name ( material . getQty_unit_name ( ) ) ;
ioStorInvDis . setPlan_qty ( qty ) ; // 直接使用 qty 变量
ioStorInvDis . setPlan _qty ( qty ) ; // 直接使用 qty 变量
ioStorInvDis . setReal _qty ( qty ) ;
io StorInvDis . setReal_qty ( qty ) ;
iO StorInvDiss . add ( ioStorInvDis ) ;
iOStorInvDiss . add ( ioStorInvDis ) ;
//更新组盘记录表
//更新组盘记录表
outFinsParams . add ( OutFinishParam . builder ( )
outFinsParams . add ( OutFinishParam . buil der ( )
. storagevehicleCode ( structattrOut . getStoragevehicle_co de ( ) )
. storagevehicleCode ( structattrOut . getStoragevehicle_code ( ) )
. changeQty ( qty )
. changeQty ( qty )
. sectCode ( storCode )
. se ctCode ( bomItem . getWarehouse _code( ) )
. stru ctCode ( structattrOut . getStruct _code( ) )
. struct Code( structattrOut . getStruct_code ( ) )
. material Code( materialCode )
. materialCode ( materialCode )
. build ( ) ) ;
. build ( ) ) ;
}
ioStorInvMapper . insert ( ioStorInvOut ) ;
ioStorInvMapper . insert ( ioStorInvOut ) ;
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDtlMapper . batchInsert ( ioStorInvDtls ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
ioStorInvDisMapper . batchSave ( iOStorInvDiss ) ;
@@ -267,12 +263,15 @@ public class MesToWmsServiceImpl implements MesToWmsService {
dataOut . put ( " cztype " , " 02 " ) ;
dataOut . put ( " cztype " , " 02 " ) ;
JSONArray entrysOut = new JSONArray ( ) ;
JSONArray entrysOut = new JSONArray ( ) ;
for ( WorkOrderBomDao item : orderBomItems ) {
for ( WorkOrderBomDao item : orderBomItems ) {
JSONObject entry = new JSONObject ( ) ;
if ( Objects . equals ( item . getMaterial_code ( ) , param . getMaterialCode ( ) ) ) {
entry . put ( " srcbillno " , orderCode ) ;
JSONObject entry = new JSONObject ( ) ;
entry . put ( " srcbillid " , w orkOrder . getOrder_id ( ) ) ; // 数量
entry . put ( " srcbillno " , orderCode ) ;
entry . put ( " srcbillentry id " , item . getItem _id ( ) ) ;
entry . put ( " srcbillid " , workOrder . getOrder _id ( ) ) ; // 数量
entry . put ( " qty " , item . getBom_qty ( ) ) ; //喷涂线边
entry . put ( " srcbillentryid " , item . getItem_id ( ) ) ;
entrysOut . add ( entry ) ;
entry . put ( " qty " , param . getLoadQty ( ) ) ; //喷涂线边
entrysOut . add ( entry ) ;
}
}
}
dataOut . put ( " entrys " , entrysOut ) ;
dataOut . put ( " entrys " , entrysOut ) ;
callbackOutData . put ( " data " , dataOut ) ;
callbackOutData . put ( " data " , dataOut ) ;