单层报工功能调整

master
zhaoxiaolin 11 months ago
parent 1a331d6b42
commit e37f464ea8

@ -136,4 +136,6 @@ public interface MesReportWorkMapper {
List<MesReportWork> getPutInOrderList(MesReportWork mesReportWorks);
ProOrderWorkorder getSonWorkOrder(String workorderCode);
public MesReportWork getReportWorkHz1(MesReportWork mesReportWork);
}

@ -287,6 +287,24 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
/****
*
*
* * ----------------------------------------
* *
* * =
* * = *
* * =
* * =
* * ----------------------------------------
* *
* * =sum(/)
* * = *
* * =
* * =
* * <p>
* *
* * =
* * = *
* * =
* * =
* @param mesReportWork
* @return
*/
@ -303,49 +321,60 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return R.fail("子母工单信息缺失");
}
R sapRson = null;
/**子工单先报工,然后母工单报工:workOrders内容就是-子子母**/
for(MesReportWork workOrder:workOrders){
if(workOrders.size()==1){
/**(一层报工)工单报工**/
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(workOrder.getWorkorderCode());
mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode());
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz1(mesReportWork);
if(sHzWorks==null){
return R.fail("未查询到一层报工单");
}
//子工单报工
logger.info("==========================一层工单报工开始");
sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================一层工单报工结束:"+JSONObject.toJSONString(sapRson));
}else if(workOrders.size()==2){
/**(两层报工)子工单先报工,然后母工单报工**/
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(workOrders.get(1).getWorkorderCode());
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if (sHzWorks == null) {
return R.fail(workOrder.getWorkorderCode()+"未查询到报工单");
if(sHzWorks==null){
return R.fail("未查询到报工单");
}
//子工单报工
logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工开始");
logger.info("==========================工单报工开始");
sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:"
+ JSONObject.toJSONString(sapRson));
if (sapRson.getCode() == 200) {
logger.info("==========================子工单报工结束:"+JSONObject.toJSONString(sapRson));
if(sapRson.getCode()== 200){
//一定是子单报工成功返回后,再母单报工
mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode());
MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(pHzWork==null){
return R.fail("未查询到母报工单");
}
try {
Thread.sleep(3000);
} catch (Exception e) {
}catch (Exception e){
e.printStackTrace();
}
//最终报工标识且sap报工成功关闭子母工单
//MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork);
}else{
//报工不成功跳出循环
break;
//母工单报工
logger.info("==========================母工单报工开始");
pHzWork.setQuantityFeedback(sHzWorks.getQuantityFeedback());
pHzWork.setSac1(sHzWorks.getSac1());
R sapR = this.reportHzToSap(pHzWork);
logger.info("==========================母工单报工结束"+JSONObject.toJSONString(sapR));
return sapR;
}
}
}else if(workOrders.size()==3){
//20240301 TODO;
}
return sapRson;
}
/**
*
* =sum(/)
* = *
* =
* =
* <p>
*
* =
* = *
* =
* =
*
* @param workOrder
* @return

@ -588,6 +588,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
<!--left join pro_route rte on rte.route_code = ow.route_code-->
</select>
<select id="getReportWorkHz1" resultType="com.op.mes.domain.MesReportWork">
select
ow.workorder_code workorderCode,
ow.workorder_code_sap workorderCodeSap,
mrw.quantity_feedback quantityFeedback,
mrw.product_code productCode,
mrw.product_name productName,
mrw.sac1,
mrw.sac2
from (
select
workorder_code,
sum(quantity_feedback) quantity_feedback,
sum(work_time) sac1,
use_man sac2,
product_code,
product_name
from
mes_report_work
where upload_status != #{uploadStatus} and prod_type = #{prodType}
and workorder_code = #{workorderCode}
group by workorder_code,product_code,product_name,use_man
) mrw
left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code
</select>
<select id="getEndReport" resultType="com.op.mes.domain.MesReportWork">
select end_report endReport
from mes_report_work

Loading…
Cancel
Save