Merge remote-tracking branch 'origin/master'

orign^2
wws 1 year ago
commit 532bcd3f0a

@ -75,4 +75,6 @@ public interface MesReportWorkConsumeMapper {
int submitConsumePS(@Param("list")List<MesReportWorkConsume> mesReportWorkConsumes); int submitConsumePS(@Param("list")List<MesReportWorkConsume> mesReportWorkConsumes);
int addConsumePS(@Param("list")List<MesReportWorkConsume> rconsumes); int addConsumePS(@Param("list")List<MesReportWorkConsume> rconsumes);
List<MesReportWorkConsume> getSonConsumeList(MesReportWorkConsume mesReportWorkConsume);
} }

@ -121,4 +121,8 @@ public interface MesReportWorkMapper {
List<MesPrepareDetail> getPrepareList(MesPrepareDetail mesPrepareDetail); List<MesPrepareDetail> getPrepareList(MesPrepareDetail mesPrepareDetail);
int addReportPS(@Param("list") List<MesReportWork> rworks); int addReportPS(@Param("list") List<MesReportWork> rworks);
public MesReportWork getReportWorkHz(MesReportWork mesReportWork);
MesReportWork getEndReport(MesReportWork pWork);
} }

@ -304,28 +304,26 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工 mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod"); mesReportWork.setProdType("prod");
mesReportWork.setWorkorderCode(sapWorkOrders.get(1).getWorkorderCode()); mesReportWork.setWorkorderCode(sapWorkOrders.get(1).getWorkorderCode());
List<MesReportWork> reportWorks = mesReportWorkMapper.getReportWork(mesReportWork); MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(CollectionUtils.isEmpty(reportWorks)){ if(sHzWorks==null){
return R.fail("未查询到报工单"); return R.fail("未查询到报工单");
} }
MesReportWork sWork = reportWorks.get(0);
//子工单报工 //子工单报工
logger.info("==========================子工单报工开始"); logger.info("==========================子工单报工开始");
this.reportToSap(sWork); this.reportHzToSap(sHzWorks);
logger.info("==========================子工单报工结束"); logger.info("==========================子工单报工结束");
mesReportWork.setWorkorderCode(sapWorkOrders.get(0).getWorkorderCode()); mesReportWork.setWorkorderCode(sapWorkOrders.get(0).getWorkorderCode());
List<MesReportWork> reportWorks2 = mesReportWorkMapper.getReportWork(mesReportWork); MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if(CollectionUtils.isEmpty(reportWorks2)){ if(pHzWork==null){
return R.fail("未查询到报工单"); return R.fail("未查询到报工单");
} }
MesReportWork pWork = reportWorks2.get(0);
//母工单报工 //母工单报工
logger.info("==========================母工单报工开始"); logger.info("==========================母工单报工开始");
this.reportToSap(pWork); this.reportHzToSap(pHzWork);
logger.info("==========================母工单报工结束"); logger.info("==========================母工单报工结束");
//最终报工标识:关闭子母工单 //最终报工标识:关闭子母工单
if("1".equals(pWork.getEndReport())){ MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork);
if("1".equals(endReport.getEndReport())){
logger.info("报工======母sap工单编码"+sapWorkOrders.get(0).getWorkorderCodeSap()+ logger.info("报工======母sap工单编码"+sapWorkOrders.get(0).getWorkorderCodeSap()+
"子sap工单编码"+sapWorkOrders.get(1).getWorkorderCodeSap() "子sap工单编码"+sapWorkOrders.get(1).getWorkorderCodeSap()
); );
@ -350,7 +348,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
return R.ok(); return R.ok();
} }
private R reportToSap(MesReportWork workOrder){ private R reportHzToSap(MesReportWork workOrder){
SapRFW sapRFW = new SapRFW(); SapRFW sapRFW = new SapRFW();
sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号 sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号
sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量 sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量
@ -379,6 +377,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
} }
sapRFW.setLt_hwList(lt_hwList); sapRFW.setLt_hwList(lt_hwList);
logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工请求"+JSONObject.toJSONString(sapRFW)); logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工请求"+JSONObject.toJSONString(sapRFW));
R r = remoteSapService.sapRFWOrder(sapRFW); R r = remoteSapService.sapRFWOrder(sapRFW);
logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工结果"+r.getCode()+","+r.getData()+","+r.getMsg()); logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工结果"+r.getCode()+","+r.getData()+","+r.getMsg());
//上传成功更改mes_report_work状态 //上传成功更改mes_report_work状态
@ -390,6 +389,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
} }
workOrder.setUploadTime(DateUtils.getNowDate()); workOrder.setUploadTime(DateUtils.getNowDate());
mesReportWorkMapper.updateSyncSapStatus(workOrder); mesReportWorkMapper.updateSyncSapStatus(workOrder);
return R.ok(); return R.ok();
} }

@ -152,7 +152,14 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public List<MesReportWorkConsume> getConsumeList(MesReportWorkConsume mesReportWorkConsume) { public List<MesReportWorkConsume> getConsumeList(MesReportWorkConsume mesReportWorkConsume) {
return mesReportWorkConsumeMapper.getConsumeList(mesReportWorkConsume); List<MesReportWorkConsume> dtos = new ArrayList<>();
if("0".equals(mesReportWorkConsume.getParentOrder())){
dtos = mesReportWorkConsumeMapper.getConsumeList(mesReportWorkConsume);
}else{
dtos = mesReportWorkConsumeMapper.getSonConsumeList(mesReportWorkConsume);
}
return dtos;
} }
@Override @Override

@ -93,12 +93,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mrwc.recoil mrwc.recoil
from mes_report_work_consume mrwc from mes_report_work_consume mrwc
where mrwc.del_flag = '0' where mrwc.del_flag = '0'
<if test='parentOrder=="0"'>
and mrwc.workorder_code = #{workorderCode} and mrwc.workorder_code = #{workorderCode}
</if> </select>
<if test='parentOrder!="0"'> <select id="getSonConsumeList" resultType="com.op.mes.domain.MesReportWorkConsume">
and mrwc.parent_order = #{workorderCode} select mrwc.record_id recordId,
</if> mrwc.workorder_code workorderCode,
mrwc.material_code materialCode,
mrwc.material_name materialName,
mrwc.quantity,
mrwc.unit,
mrwc.create_time createTime,
mrwc.recoil
from mes_report_work_consume mrwc
left join pro_order_workorder pow on pow.workorder_code = mrwc.workorder_code
where mrwc.del_flag = '0'
and pow.parent_order = #{workorderCode}
</select> </select>
<insert id="insertMesReportWorkConsume" parameterType="MesReportWorkConsume"> <insert id="insertMesReportWorkConsume" parameterType="MesReportWorkConsume">

@ -469,8 +469,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getReportWorkHzList" resultType="com.op.mes.domain.MesReportWork"> <select id="getReportWorkHzList" resultType="com.op.mes.domain.MesReportWork">
select mrw.workorderCode,mrw.productCode,mrw.productName,mrw.machineCode,mrw.machineName, select mrw.workorderCode,mrw.productCode,mrw.productName,mrw.machineCode,mrw.machineName,
mrw.shiftCode,mrw.feedbackTime feedbackTimeStr,mrw.quantityFeedback,mrw.unit, mrw.shiftCode,mrw.feedbackTime feedbackTimeStr,mrw.quantityFeedback,
mrw.workTime,mrw.useMan,mrw.uploadTime,mrw.uploadStatus, mrw.workTime,mrw.useMan,mrw.uploadStatus,<!--mrw.uploadTime,mrw.unit,-->
pow.order_code orderCode,pow.quantity_split quantity pow.order_code orderCode,pow.quantity_split quantity
from ( from (
select workorder_code workorderCode, select workorder_code workorderCode,
@ -483,9 +483,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sum(quantity_feedback) quantityFeedback, sum(quantity_feedback) quantityFeedback,
sum(work_time) workTime, sum(work_time) workTime,
sum(use_man) useMan, sum(use_man) useMan,
upload_time uploadTime, upload_status uploadStatus
upload_status uploadStatus, <!--,upload_time uploadTime,
unit ,
unit-->
from mes_report_work from mes_report_work
where del_flag = '0' and parent_order = '0' where del_flag = '0' and parent_order = '0'
<if test="workorderCode != null and workorderCode != ''"> and workorder_code like concat('%', #{workorderCode}, '%')</if> <if test="workorderCode != null and workorderCode != ''"> and workorder_code like concat('%', #{workorderCode}, '%')</if>
@ -496,8 +497,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="feedbackTimeStart != null "> and CONVERT(varchar(19),feedback_time, 120) >= #{feedbackTimeStart}</if> <if test="feedbackTimeStart != null "> and CONVERT(varchar(19),feedback_time, 120) >= #{feedbackTimeStart}</if>
<if test="feedbackTimeEnd != null "> and #{feedbackTimeEnd} >= CONVERT(varchar(19),feedback_time, 120)</if> <if test="feedbackTimeEnd != null "> and #{feedbackTimeEnd} >= CONVERT(varchar(19),feedback_time, 120)</if>
<if test="uploadStatus != null and uploadStatus != ''"> and upload_status = #{uploadStatus}</if> <if test="uploadStatus != null and uploadStatus != ''"> and upload_status = #{uploadStatus}</if>
group by workorder_code, product_code,product_name,CONVERT(varchar(10),feedback_time, 120),machine_code,machine_name,shift_code, group by workorder_code, product_code,product_name,CONVERT(varchar(10),feedback_time, 120),machine_code,machine_name,shift_code
upload_time,upload_status,unit ,upload_status
<!--,upload_time,unit-->
) mrw ) mrw
left join pro_order_workorder pow on mrw.workorderCode = pow.workorder_code left join pro_order_workorder pow on mrw.workorderCode = pow.workorder_code
<where> <where>
@ -542,6 +544,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mp.del_flag = '0' and mpd.del_flag = '0' and mp.del_flag = '0' and mpd.del_flag = '0'
order by mp.workorder_code order by mp.workorder_code
</select> </select>
<select id="getReportWorkHz" 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,
rte.tec_machine sac1,
rte.tec_man sac2,
rte.tec_depreciation sac3,
rte.tec_other sac4,
rte.tec_conf_acivity5 sac5,
rte.tec_conf_acivity6 sac6
from (
select
workorder_code,
sum(quantity_feedback) quantity_feedback,
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
) mrw
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="getEndReport" resultType="com.op.mes.domain.MesReportWork">
select end_report endReport
from mes_report_work
where end_report = '1' and workorder_code = #{workorderCode}
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork"> <insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work insert into mes_report_work

@ -63,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="prodSpc != null and prodSpc != ''"> and prod_spc = #{prodSpc}</if> <if test="prodSpc != null and prodSpc != ''"> and prod_spc = #{prodSpc}</if>
<if test="planDateStart != null "> and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}'</if> <if test="planDateStart != null "> and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}'</if>
<if test="planDateEnd != null "> and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120)</if> <if test="planDateEnd != null "> and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120)</if>
</where>
and prod_type != 'white' and prod_type != 'white'
and del_flag = '0' and del_flag = '0'
</where>
ORDER BY plan_pro_date DESC ORDER BY plan_pro_date DESC
</select> </select>

Loading…
Cancel
Save