|
|
|
@ -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
|
|
|
|
|