@@ -90,9 +90,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
@Override
public ProduceshiftorderDto findById ( Long produce order_id) {
public ProduceshiftorderDto findById ( Long work order_id) {
WQLObject wo = WQLObject . getWQLObject ( " mps_bd_produceshiftorder " ) ;
JSONObject json = wo . query ( " produce order_id = '" + produce order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject json = wo . query ( " work order_id = '" + work order_id + " ' " ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isNotEmpty ( json ) ) {
return json . toJavaObject ( ProduceshiftorderDto . class ) ;
}
@@ -162,9 +162,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String now = DateUtil . now ( ) ;
WQLObject wo = WQLObject . getWQLObject ( " mps_bd_produceshiftorder " ) ;
for ( Long produce order_id : ids ) {
for ( Long work order_id : ids ) {
JSONObject param = new JSONObject ( ) ;
param . put ( " produce order_id" , String . valueOf ( produce order_id) ) ;
param . put ( " work order_id" , String . valueOf ( work order_id) ) ;
param . put ( " is_delete " , " 1 " ) ;
param . put ( " update_optid " , currentUserId ) ;
param . put ( " update_optname " , nickName ) ;
@@ -181,7 +181,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String now = DateUtil . now ( ) ;
WQLObject wo = WQLObject . getWQLObject ( " mps_bd_produceshiftorder " ) ;
JSONObject json = wo . query ( " produce order_id = '" + param . getString ( " produce order_id" ) + " ' " ) . uniqueResult ( 0 ) ;
JSONObject json = wo . query ( " work order_id = '" + param . getString ( " work order_id" ) + " ' " ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( json . getString ( " device_id " ) ) ) throw new BadRequestException ( " 请先绑定设备 " ) ;
JSONArray orderArr = wo . query ( " device_id = ' " + param . getString ( " device_id " ) + " ' and order_status = '02' " ) . getResultJSONArray ( 0 ) ;
@@ -250,7 +250,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
JSONObject device = wo_device . query ( " device_id = ' " + device_id + " ' " ) . uniqueResult ( 0 ) ;
String device_code = device . getString ( " device_code " ) ;
JSONObject row = param . getJSONObject ( " row " ) ;
String produce order_id = row . getString ( " produce order_id" ) ;
String work order_id = row . getString ( " work order_id" ) ;
String workprocedure_id = row . getString ( " workprocedure_id " ) ;
String produceorder_code = row . getString ( " produceorder_code " ) ;
String material_id = row . getString ( " material_id " ) ;
@@ -262,9 +262,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String order_status = row . getString ( " order_status " ) ;
//开工时修改生产班次工单表 生产设备、以及工单状态
WQLObject wo = WQLObject . getWQLObject ( " MPS_BD_ProduceShiftOrder " ) ;
JSONObject jsonObject1 = wo . query ( " produce order_id = '" + produce order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject jsonObject1 = wo . query ( " work order_id = '" + work order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject produceorderMap = new JSONObject ( ) ;
produceorderMap . put ( " produce order_id" , produce order_id) ;
produceorderMap . put ( " work order_id" , work order_id) ;
produceorderMap . put ( " device_id " , device_id ) ;
produceorderMap . put ( " order_status " , " 02 " ) ;
produceorderMap . put ( " update_optid " , currentUserId ) ;
@@ -280,11 +280,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
recordMap . put ( " macoperate_id " , IdUtil . getSnowflake ( 1 , 1 ) . nextId ( ) ) ;
recordMap . put ( " device_id " , device_id ) ;
recordMap . put ( " workprocedure_id " , workprocedure_id ) ;
recordMap . put ( " produce order_id" , produce order_id) ;
recordMap . put ( " work order_id" , work order_id) ;
recordMap . put ( " produceorder_code " , produceorder_code ) ;
recordMap . put ( " init_qty " , jsonObject1 . getString ( " real_qty " ) ) ;
//填写生产记录表中的生产数量时,先判断是否已经生产过了,如果没有生产过,就将工单记录表中的计划数量付给记录表中的生产数量
final JSONArray alreadyPro = wo_record . query ( " produce order_id = '" + produce order_id + " ' " ) . getResultJSONArray ( 0 ) ;
final JSONArray alreadyPro = wo_record . query ( " work order_id = '" + work order_id + " ' " ) . getResultJSONArray ( 0 ) ;
if ( ObjectUtil . isEmpty ( alreadyPro ) ) {
recordMap . put ( " produce_qty " , plan_qty ) ;
//同时向acs系统下发工单 问题是现在一个工单分多次执行, 现在是每开工一次, 向acs发送一次工单
@@ -293,7 +293,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
// TODO
JSONArray array = new JSONArray ( ) ;
JSONObject acsObj = new JSONObject ( ) ;
acsObj . put ( " ext_order_id " , produce order_id) ;
acsObj . put ( " ext_order_id " , work order_id) ;
acsObj . put ( " is_needmove " , is_needmove ) ;
acsObj . put ( " order_code " , produceorder_code ) ;
acsObj . put ( " qty " , plan_qty ) ;
@@ -319,7 +319,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
// TODO
JSONArray array = new JSONArray ( ) ;
JSONObject map = new JSONObject ( ) ;
map . put ( " ext_order_id " , produce order_id) ;
map . put ( " ext_order_id " , work order_id) ;
map . put ( " type " , " 2 " ) ;
array . add ( map ) ;
wmsToAcsService . orderStatusUpdate ( array ) ;
@@ -337,12 +337,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String now = DateUtil . now ( ) ;
final String report_qty = param . getString ( " report_qty " ) ;
final JSONObject row = param . getJSONObject ( " row " ) ;
final String produce order_id = row . getString ( " produce order_id" ) ;
final String work order_id = row . getString ( " work order_id" ) ;
//报工时工单的工单状态为暂停,报工数量为这条工单上次加这次报工数量的和,也就是这条工单每次记录的和
WQLObject wo = WQLObject . getWQLObject ( " MPS_BD_ProduceShiftOrder " ) ;
JSONObject jsonObject = wo . query ( " produce order_id = '" + produce order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject jsonObject = wo . query ( " work order_id = '" + work order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject produceorderMap = new JSONObject ( ) ;
produceorderMap . put ( " produce order_id" , produce order_id) ;
produceorderMap . put ( " work order_id" , work order_id) ;
if ( row . getString ( " report_qty " ) . equals ( " 0 " ) | | StrUtil . isEmpty ( row . getString ( " report_qty " ) ) ) {
produceorderMap . put ( " report_qty " , report_qty ) ;
} else {
@@ -357,7 +357,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
//同时修改这条工单对应的记录表中最新的一条数据的报工数量
WQLObject wo_record = WQLObject . getWQLObject ( " MPS_BD_MacOperateRecord " ) ;
//获取最新的工单的对应记录信息
JSONObject newRecord = wo_record . query ( " produce order_id = '" + produce order_id+ " ' and (operatetime_end is null or operatetime_end = '') " ) . uniqueResult ( 0 ) ;
JSONObject newRecord = wo_record . query ( " work order_id = '" + work order_id+ " ' and (operatetime_end is null or operatetime_end = '') " ) . uniqueResult ( 0 ) ;
newRecord . put ( " report_qty " , report_qty ) ;
newRecord . put ( " finish_qty " , jsonObject . getString ( " real_qty " ) ) ;
Integer finishproduct_qty = Integer . parseInt ( jsonObject . getString ( " real_qty " ) ) - Integer . parseInt ( newRecord . getString ( " init_qty " ) ) ;
@@ -369,7 +369,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
// TODO
JSONArray array = new JSONArray ( ) ;
JSONObject map = new JSONObject ( ) ;
map . put ( " ext_order_id " , produce order_id) ;
map . put ( " ext_order_id " , work order_id) ;
map . put ( " type " , " 1 " ) ;
array . add ( map ) ;
wmsToAcsService . orderStatusUpdate ( array ) ;
@@ -382,10 +382,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String nickName = SecurityUtils . getCurrentNickName ( ) ;
String now = DateUtil . now ( ) ;
JSONObject row = param . getJSONObject ( " row " ) ;
String produce order_id = row . getString ( " produce order_id" ) ;
String work order_id = row . getString ( " work order_id" ) ;
WQLObject wo = WQLObject . getWQLObject ( " MPS_BD_ProduceShiftOrder " ) ;
JSONObject produceorderMap = new JSONObject ( ) ;
produceorderMap . put ( " produce order_id" , produce order_id) ;
produceorderMap . put ( " work order_id" , work order_id) ;
produceorderMap . put ( " order_status " , " 04 " ) ;
produceorderMap . put ( " update_optid " , currentUserId ) ;
produceorderMap . put ( " device_id " , null ) ;
@@ -397,7 +397,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
// TODO
JSONArray array = new JSONArray ( ) ;
JSONObject map = new JSONObject ( ) ;
map . put ( " ext_order_id " , produce order_id) ;
map . put ( " ext_order_id " , work order_id) ;
map . put ( " type " , " 3 " ) ;
array . add ( map ) ;
wmsToAcsService . orderStatusUpdate ( array ) ;
@@ -405,12 +405,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Override
public JSONObject getReportWork ( JSONObject param ) {
String produce order_id = param . getString ( " produce order_id" ) ;
String work order_id = param . getString ( " work order_id" ) ;
WQLObject wo = WQLObject . getWQLObject ( " MPS_BD_ProduceShiftOrder " ) ;
JSONObject jsonProduceShiftOrder = wo . query ( " produce order_id = '" + produce order_id + " ' " ) . uniqueResult ( 0 ) ;
JSONObject jsonProduceShiftOrder = wo . query ( " work order_id = '" + work order_id + " ' " ) . uniqueResult ( 0 ) ;
WQLObject wo_record = WQLObject . getWQLObject ( " MPS_BD_MacOperateRecord " ) ;
//获取最新的工单的对应记录信息
JSONObject jsonObject = wo_record . query ( " produce order_id = '" + produce order_id+ " ' and (operatetime_end is null or operatetime_end = '') " ) . uniqueResult ( 0 ) ;
JSONObject jsonObject = wo_record . query ( " work order_id = '" + work order_id+ " ' and (operatetime_end is null or operatetime_end = '') " ) . uniqueResult ( 0 ) ;
String finish_qty = jsonProduceShiftOrder . getString ( " real_qty " ) ;
jsonObject . put ( " finish_qty " , finish_qty ) ;
Integer finishproduct_qty = Integer . parseInt ( finish_qty ) - Integer . parseInt ( jsonObject . getString ( " init_qty " ) ) ;
@@ -426,10 +426,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Override
public JSONArray getDtl ( JSONObject param ) {
final String produce order_id = param . getString ( " produce order_id" ) ;
final String work order_id = param . getString ( " work order_id" ) ;
JSONObject map = new JSONObject ( ) ;
map . put ( " flag " , " 5 " ) ;
map . put ( " produce order_id" , produce order_id) ;
map . put ( " work order_id" , work order_id) ;
JSONArray resultJSONArray = WQL . getWO ( " MPS_PRODUCEDURE001 " ) . addParamMap ( map ) . process ( ) . getResultJSONArray ( 0 ) ;
return resultJSONArray ;
}