Merge remote-tracking branch 'origin/master'

master
Yangwl 11 months ago
commit b2dd3e1990

@ -392,7 +392,7 @@ public class MesReportWorkController extends BaseController {
return mesReportWorkService.getBatchList(ProOrderWorkorder); return mesReportWorkService.getBatchList(ProOrderWorkorder);
} }
/**获取母子报工记录**/ /**获取母子报工记录(废弃)---改为2.0查询各级报工详细列表**/
@RequiresPermissions("mes:reportWork:report") @RequiresPermissions("mes:reportWork:report")
@GetMapping("/getReportList") @GetMapping("/getReportList")
public List getReportList(MesReportWork mesReportWork) { public List getReportList(MesReportWork mesReportWork) {
@ -400,6 +400,14 @@ public class MesReportWorkController extends BaseController {
return rlist; return rlist;
} }
/**2.0查询各级报工详细列表**/
@RequiresPermissions("mes:reportWork:report")
@GetMapping("/getAllLevelReportList")
public List getAllLevelReportList(MesReportWork mesReportWork) {
List<MesReportWorkTabs> rlist = mesReportWorkService.getAllLevelReportList(mesReportWork);
return rlist;
}
@PostMapping("/submitReportPS") @PostMapping("/submitReportPS")
public AjaxResult submitReportPS(@RequestBody List<MesReportWork> mesReportWorks) { public AjaxResult submitReportPS(@RequestBody List<MesReportWork> mesReportWorks) {
return toAjax(mesReportWorkService.submitReportPS(mesReportWorks)); return toAjax(mesReportWorkService.submitReportPS(mesReportWorks));

@ -0,0 +1,48 @@
package com.op.mes.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* mes_report_work
*
* @author Open Platform
* @date 2023-08-24
*/
public class MesReportWorkTabs extends BaseEntity {
private static final long serialVersionUID = 1L;
private String libId;
private String title;
private List<MesReportWork> libList;
public String getLibId() {
return libId;
}
public void setLibId(String libId) {
this.libId = libId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<MesReportWork> getLibList() {
return libList;
}
public void setLibList(List<MesReportWork> libList) {
this.libList = libList;
}
}

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

@ -106,4 +106,6 @@ public interface IMesReportWorkService {
int reportSapCancel(MesReportWork mesReportWork); int reportSapCancel(MesReportWork mesReportWork);
List<MesReportWork> getPutInOrderList(MesReportWork mesReportWorks); List<MesReportWork> getPutInOrderList(MesReportWork mesReportWorks);
List<MesReportWorkTabs> getAllLevelReportList(MesReportWork mesReportWork);
} }

@ -298,54 +298,39 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
} }
//根据belong_work_order找到sap工单 //根据belong_work_order找到sap工单
List<MesReportWork> sapWorkOrders = mesReportWorkMapper.getSapWorkOrder(mesReportWork.getWorkorderCode()); List<MesReportWork> workOrders = mesReportWorkMapper.getSapWorkOrder(mesReportWork.getWorkorderCode());
if (CollectionUtils.isEmpty(sapWorkOrders) || sapWorkOrders.size() < 2) { if (CollectionUtils.isEmpty(workOrders)) {
return R.fail("子母工单信息缺失"); return R.fail("子母工单信息缺失");
} }
/**子工单先报工,然后母工单报工**/ R sapRson = null;
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工 /**子工单先报工,然后母工单报工:workOrders内容就是-子子母**/
mesReportWork.setProdType("prod"); for(MesReportWork workOrder:workOrders){
mesReportWork.setWorkorderCode(sapWorkOrders.get(1).getWorkorderCode()); mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork); mesReportWork.setProdType("prod");
if (sHzWorks == null) { mesReportWork.setWorkorderCode(workOrder.getWorkorderCode());
return R.fail("未查询到子报工单"); MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork);
} if (sHzWorks == null) {
//子工单报工 return R.fail(workOrder.getWorkorderCode()+"未查询到报工单");
logger.info("==========================子工单报工开始");
R sapRson = this.reportHzToSap(sHzWorks);
logger.info("==========================子工单报工结束:" + JSONObject.toJSONString(sapRson));
if (sapRson.getCode() == 200) {
//一定是子单报工成功返回后,再母单报工
mesReportWork.setWorkorderCode(sapWorkOrders.get(0).getWorkorderCode());
MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork);
if (pHzWork == null) {
return R.fail("未查询到母报工单");
} }
try { //子工单报工
Thread.sleep(3000); logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工开始");
} catch (Exception e) { sapRson = this.reportHzToSap(sHzWorks);
e.printStackTrace(); logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:"
+ JSONObject.toJSONString(sapRson));
if (sapRson.getCode() == 200) {
try {
Thread.sleep(3000);
} 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;
//最终报工标识且sap报工成功关闭子母工单
// MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork);
//-----改为由上位机触发
// if("1".equals(endReport.getEndReport())&&sapR.getCode()==200){
// MesReportWork rworkVo = new MesReportWork();
// rworkVo.setStatus("w3");
// rworkVo.setUpdateTime(DateUtils.getNowDate());
// rworkVo.setUpdateBy(SecurityUtils.getUsername());
// rworkVo.setWorkorderCode(belongWorkOrder);
// //pro_work_order status->w3报工--belong_work_order
// mesReportWorkMapper.updateOrderWorkStatus(rworkVo);
// }
} }
return sapRson; return sapRson;
} }

@ -151,6 +151,37 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return mesReportWorkMapper.getReportList(mesReportWork); return mesReportWorkMapper.getReportList(mesReportWork);
} }
@Override
@DS("#header.poolName")
public List<MesReportWorkTabs> getAllLevelReportList(MesReportWork mesReportWork) {
List<MesReportWorkTabs> tabs = new ArrayList<>();
MesReportWorkTabs pTabs = new MesReportWorkTabs();
int i = 1;
pTabs.setLibId("order"+i);
pTabs.setTitle("第"+i+"层工单信息");
mesReportWork.setParentOrder("0");
List<MesReportWork> liblist0 = mesReportWorkMapper.getReportList(mesReportWork);
pTabs.setLibList(liblist0);
tabs.add(pTabs);
ProOrderWorkorder sonWorkOrder = mesReportWorkMapper.getSonWorkOrder(mesReportWork.getWorkorderCode());
while(sonWorkOrder!=null){
int xh = ++i;
MesReportWorkTabs sTabs = new MesReportWorkTabs();
sTabs.setLibId("order"+xh);
sTabs.setTitle("第"+xh+"层工单信息");
mesReportWork.setParentOrder(sonWorkOrder.getParentOrder());
mesReportWork.setWorkorderCode(sonWorkOrder.getParentOrder());
List<MesReportWork> liblist = mesReportWorkMapper.getReportList(mesReportWork);
sTabs.setLibList(liblist);
tabs.add(sTabs);
sonWorkOrder = mesReportWorkMapper.getSonWorkOrder(sonWorkOrder.getWorkorderCode());
}
return tabs;
}
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public int submitReportPS(List<MesReportWork> mesReportWorks) { public int submitReportPS(List<MesReportWork> mesReportWorks) {

@ -473,7 +473,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
workorder_code workorderCode workorder_code workorderCode
from pro_order_workorder from pro_order_workorder
where belong_work_order = #{workorderCode} and del_flag = '0' <!--and status = 'w2'--> where belong_work_order = #{workorderCode} and del_flag = '0' <!--and status = 'w2'-->
order by parent_order order by order_code
</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,
@ -651,7 +651,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mrw.unit, mrw.unit,
pow.factory_code factoryCode, pow.factory_code factoryCode,
equ.workshop_name workshopName, equ.workshop_name workshopName,
pow.attr2 version po.atrr2 version
from mes_report_work mrw from mes_report_work mrw
left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code left join pro_order_workorder pow on mrw.workorder_code = pow.workorder_code
left join base_equipment equ on equ.equipment_code = mrw.machine_code left join base_equipment equ on equ.equipment_code = mrw.machine_code
@ -660,8 +660,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mrw.workorder_code = #{workorderCode} and mrw.workorder_code = #{workorderCode}
and mrw.del_flag = '0' and po.del_flag = '0' and mrw.del_flag = '0' and po.del_flag = '0'
</select> </select>
<select id="getSonWorkOrder" resultType="com.op.mes.domain.ProOrderWorkorder">
select workorder_code workorderCode,
parent_order parentOrder
from pro_order_workorder
where parent_order = #{workorderCode}
and del_flag='0'
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork"> <insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work insert into mes_report_work
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>

@ -121,6 +121,23 @@ public class ProOrderWorkorderController extends BaseController {
List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder);
return getDataTable(list); return getDataTable(list);
} }
/**查询生产工单列表--顶级母单**/
@RequiresPermissions("mes:pro:proworkorder:list")
@GetMapping("/listLevel0")
public TableDataInfo listLevel0(ProOrderWorkorder proOrderWorkorder) {
startPage();
List<ProOrderWorkorder> list = proOrderWorkorderService.getWorkorderLevel0List(proOrderWorkorder);
return getDataTable(list);
}
/**查询生产工单列表--下一级**/
@GetMapping("/getNextLevelWorkOrderList/{parentOrder}")
public List<ProOrderWorkorder> getNextLevelWorkOrderList(@PathVariable("parentOrder") String parentOrder) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
proOrderWorkorder.setParentOrder(parentOrder);
List<ProOrderWorkorder> list = proOrderWorkorderService.getNextLevelWorkOrderList(proOrderWorkorder);
return list;
}
/** /**
* *
@ -218,7 +235,7 @@ public class ProOrderWorkorderController extends BaseController {
} }
/** /**
* * workorderIds
*/ */
@RequiresPermissions("mes:pro:workorder:edit") @RequiresPermissions("mes:pro:workorder:edit")
@Log(title = "下发生产工单", businessType = BusinessType.OTHER) @Log(title = "下发生产工单", businessType = BusinessType.OTHER)

@ -286,6 +286,16 @@ public class ProOrderWorkorder extends TreeEntity {
*/ */
private String factoryCode; private String factoryCode;
private Boolean hasChildren;
public Boolean getHasChildren() {
return hasChildren;
}
public void setHasChildren(Boolean hasChildren) {
this.hasChildren = hasChildren;
}
public String getPproductCode() { public String getPproductCode() {
return pproductCode; return pproductCode;
} }

@ -178,5 +178,11 @@ public interface ProOrderWorkorderMapper {
List<ProOrderWorkorder> selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder); List<ProOrderWorkorder> selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder);
ProWetMaterialPlanDetail getWetMaterial(String workorderId); ProWetMaterialPlanDetail getWetMaterial(String workorderId);
List<ProOrderWorkorder> getLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder);
ProOrderWorkorder getSonWorkOrder(ProOrderWorkorder whiteOrder);
ProOrderWorkorder selectSonWorkOrder(String workorderCode);
} }

@ -125,4 +125,8 @@ public interface IProOrderWorkorderService {
void deleteWhiteWorkorderByWorkOrder(List<ProOrderWorkorder> whiteWorkOrder); void deleteWhiteWorkorderByWorkOrder(List<ProOrderWorkorder> whiteWorkOrder);
AjaxResult subChangeWorkOrderM(SplitOrderDTO splitOrderDTO); AjaxResult subChangeWorkOrderM(SplitOrderDTO splitOrderDTO);
List<ProOrderWorkorder> getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder);
List<ProOrderWorkorder> getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder);
} }

@ -321,8 +321,10 @@ public class ProOrderServiceImpl implements IProOrderService {
// code自增 // code自增
endCode++; endCode++;
} else { } else {
// 设置子节点end_flag字段信息 if(!"0".equals(workOrder.getParentOrder())) {
workOrder.setEndFlag(1); // 设置子节点end_flag字段信息
workOrder.setEndFlag(1);
}
// 更新数据库记录信息 // 更新数据库记录信息
proOrderWorkorderMapper.updateProOrderWorkorder(workOrder); proOrderWorkorderMapper.updateProOrderWorkorder(workOrder);
// 结束循环 // 结束循环

@ -64,8 +64,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
@Autowired @Autowired
private ProOrderMapper proOrderMapper; private ProOrderMapper proOrderMapper;
@Autowired @Autowired
private ProWorkorderProcessDetailMapper proWorkorderProcessDetailMapper;
@Autowired
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
@Autowired @Autowired
private RemoteSapService remoteSapService; private RemoteSapService remoteSapService;
@ -140,6 +138,71 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return workorderList; return workorderList;
} }
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder);
for (ProOrderWorkorder workorder : workorderList) {
// List<ProOrderWorkorder> childrens = new ArrayList<>();
// ProOrderWorkorder child = new ProOrderWorkorder();
// child.setWorkorderCode("test");
// childrens.add(child);
// workorder.setChildren(childrens);
workorder.setHasChildren(true);
String prodLineName = "";
String equipCods = "'";
JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode());
for (int c = 0; c < codeArray.size(); c++) {
equipCods += codeArray.getJSONArray(c).getString(1) + "','";
}
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
for (int c = 0; c < codeArray.size(); c++) {
String equipCode = codeArray.getJSONArray(c).getString(1);
CascaderDTO eInfo = equipMap.get(equipCode);
if (eInfo != null) {
prodLineName += eInfo.getLabel() + ",";
}
}
workorder.setProdLineName(prodLineName);
// 通过工艺编码code查询出机型名称
workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode()));
}
return workorderList;
}
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder);
for (ProOrderWorkorder workorder : workorderList) {
String prodLineName = "";
String equipCods = "'";
JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode());
for (int c = 0; c < codeArray.size(); c++) {
equipCods += codeArray.getJSONArray(c).getString(1) + "','";
}
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
for (int c = 0; c < codeArray.size(); c++) {
String equipCode = codeArray.getJSONArray(c).getString(1);
CascaderDTO eInfo = equipMap.get(equipCode);
if (eInfo != null) {
prodLineName += eInfo.getLabel() + ",";
}
}
workorder.setProdLineName(prodLineName);
// 通过工艺编码code查询出机型名称
workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode()));
workorder.setHasChildren(true);
}
return workorderList;
}
/** /**
* *
* *
@ -290,26 +353,30 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
wids.add(whiteOrder.getWorkorderId()); wids.add(whiteOrder.getWorkorderId());
wcodes.add(whiteOrder.getWorkorderCode()); wcodes.add(whiteOrder.getWorkorderCode());
ordercodes.add(whiteOrder.getOrderCode()); ordercodes.add(whiteOrder.getOrderCode());
Boolean isTop = true; Boolean isNotTop = true;
//成品的母工单//查上一级工单 //成品的母工单//查下一级工单
while (isTop) { while (isNotTop) {
//查上一级工单 if(!"0".equals(whiteOrder.getParentOrder())){
whiteOrder.setWorkorderCode(whiteOrder.getParentOrder()); //查上一级工单
ProOrderWorkorder pWorkOrder = proOrderWorkorderMapper.getPWorkOrder(whiteOrder); whiteOrder.setWorkorderCode(whiteOrder.getParentOrder());
if (pWorkOrder != null) { ProOrderWorkorder sWorkOrder = proOrderWorkorderMapper.getSonWorkOrder(whiteOrder);
wids.add(pWorkOrder.getWorkorderId()); if (sWorkOrder != null) {
wcodes.add(pWorkOrder.getWorkorderCode()); wids.add(sWorkOrder.getWorkorderId());
ordercodes.add(pWorkOrder.getOrderCode()); wcodes.add(sWorkOrder.getWorkorderCode());
} ordercodes.add(sWorkOrder.getOrderCode());
if ("0".equals(pWorkOrder.getParentOrder())) { }
BeanUtils.copyProperties(pWorkOrder, whiteOrder); if ("0".equals(sWorkOrder.getParentOrder())) {
isTop = false; BeanUtils.copyProperties(sWorkOrder, whiteOrder);
isNotTop = false;
}
}else{
isNotTop = false;
} }
} }
//顺序母子 //顺序子母->母子
Collections.reverse(wids); // Collections.reverse(wids);
Collections.reverse(wcodes); // Collections.reverse(wcodes);
Collections.reverse(ordercodes); // Collections.reverse(ordercodes);
sapList = new ArrayList<>(); sapList = new ArrayList<>();
SapCreateOrder sap = new SapCreateOrder(); SapCreateOrder sap = new SapCreateOrder();
@ -356,11 +423,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
//关闭母子订单//订单的订单编码(关闭订单暂时隐藏) //关闭母子订单//订单的订单编码(关闭订单暂时隐藏)
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery(); SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
sapCloseOrderQuery.setLeadOrder(ordercodes.get(0)); sapCloseOrderQuery.setOrderCodes(ordercodes);
sapCloseOrderQuery.setOrder(ordercodes.get(1));
R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery); R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery);
logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭母订单"+sapCloseOrderQuery.getLeadOrder()+":"+ logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭老订单"+
sapCloseOrderQuery.getOrder()+":"+ JSONObject.toJSONString(sapCloseOrderQuery)+
closeR.getCode()+","+ closeR.getCode()+","+
closeR.getMsg()+","+ closeR.getMsg()+","+
closeR.getData()); closeR.getData());
@ -488,16 +554,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return success(orderAndWork); return success(orderAndWork);
} else { } else {
boolean run = true;
while (run) {
ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder());
// 如果存在父工单
if (fatherWorkOrder != null) {
BeanUtils.copyProperties(fatherWorkOrder, proOrderWorkorder);
} else {
run = false;
}
}
// 通过母订单id查询母订单详情 // 通过母订单id查询母订单详情
ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId()); ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId());
if (proOrder != null) { if (proOrder != null) {
@ -894,7 +950,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
} }
/** /**
* code * code
* *
* @param code * @param code
* @return * @return
@ -905,34 +961,24 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
// 创建返回工单列表 // 创建返回工单列表
List<ProOrderWorkorder> proOrderWorkorderList = new ArrayList<ProOrderWorkorder>(); List<ProOrderWorkorder> proOrderWorkorderList = new ArrayList<ProOrderWorkorder>();
// 查询该工单信息 // 查询该工单信息
ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); ProOrderWorkorder pWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code);
formatProOrderWorkorder(proOrderWorkorder); formatProOrderWorkorder(pWorkorder);
proOrderWorkorderList.add(proOrderWorkorder); proOrderWorkorderList.add(pWorkorder);
boolean flag = true; boolean flag = true;
String parentOrder = pWorkorder.getWorkorderCode();
// 临时存放parentCode //母查子遍历
StringBuilder tempCode = new StringBuilder();
tempCode.append(proOrderWorkorder.getParentOrder());
while (flag) { while (flag) {
ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(tempCode.toString()); ProOrderWorkorder workorder = proOrderWorkorderMapper.selectSonWorkOrder(parentOrder);
if (workorder != null) { if (workorder != null) {
formatProOrderWorkorder(workorder); formatProOrderWorkorder(workorder);
proOrderWorkorderList.add(workorder); proOrderWorkorderList.add(workorder);
tempCode.setLength(0); parentOrder = workorder.getWorkorderCode();
tempCode.append(workorder.getParentOrder());
} else { } else {
flag = false; flag = false;
} }
} }
// 反转list return success(proOrderWorkorderList);
List<ProOrderWorkorder> reversalWorkOrderList = new ArrayList<>();
for (int i = proOrderWorkorderList.size() - 1; i >= 0; i--) {
reversalWorkOrderList.add(proOrderWorkorderList.get(i));
}
return success(reversalWorkOrderList);
} }
/** /**
@ -1033,6 +1079,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
proOrderWorkorder.setShiftDesc(shiftDesc); proOrderWorkorder.setShiftDesc(shiftDesc);
proOrderWorkorder.setBatchCodeList(batchCodes); proOrderWorkorder.setBatchCodeList(batchCodes);
proOrderWorkorder.setBatchNumList(batchNums); proOrderWorkorder.setBatchNumList(batchNums);
proOrderWorkorder.setHasChildren(null);//会直接导致树结构不展示
// 通过母工单workorder_id查询子工单 // 通过母工单workorder_id查询子工单
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode()); List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode());
if (!childWorkorders.isEmpty()) { if (!childWorkorders.isEmpty()) {

@ -65,7 +65,7 @@
pow.workorder_code_sap, pow.workorder_code_sap,
ppow.product_code pproductCode,ppow.product_name pproductName,ppow.workorder_code_sap pworkorderCodeSap ppow.product_code pproductCode,ppow.product_name pproductName,ppow.workorder_code_sap pworkorderCodeSap
from pro_order_workorder pow from pro_order_workorder pow
left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code and ppow.del_flag = '0'
<where> <where>
<if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%', <if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%',
#{workorderCode}, '%') #{workorderCode}, '%')
@ -95,7 +95,45 @@
</if> </if>
<if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120) <if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)
</if> </if>
and pow.del_flag = '0' and ppow.del_flag = '0' and pow.del_flag = '0'
</where>
</select>
<select id="getLevelWorkOrderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code,
pow.product_code, pow.product_name,pow.product_spc, pow.unit, pow.quantity_split,
pow.route_code, pow.prod_line_code, pow.product_date,
pow.shift_id, pow.parent_order,pow.status, pow.prod_type,pow.factory_code,
pow.end_flag,pow.car_num,pow.sort_no,
pow.workorder_code_sap
from pro_order_workorder pow
<where>
<if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%',
#{workorderCode}, '%')
</if>
<if test="workorderName != null and workorderName != ''">and pow.workorder_name like concat('%',
#{workorderName}, '%')
</if>
<if test="orderId != null and orderId != ''">and pow.order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''">and pow.order_code like concat('%', #{orderCode}, '%')</if>
<if test="productCode != null and productCode != ''">
and ppow.product_code like concat('%', #{productCode},'%')
</if>
<if test="productName != null and productName != ''">
and ppow.product_name like concat('%', #{productName},'%')
</if>
<if test="productDate != null ">and pow.product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''">and pow.shift_id = #{shiftId}</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="statusArray != null and statusArray != ''">and pow.status in (${statusArray})</if>
<if test="prodType != null and prodType != ''">and pow.prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''">and pow.factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''">and pow.end_flag = #{endFlag}</if>
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >=
'${productDateStart}'
</if>
<if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)</if>
and pow.parent_order = #{parentOrder}
and pow.del_flag = '0'
</where> </where>
</select> </select>
<select id="selectProOrderWorkorderList999" resultMap="ProOrderWorkorderResult"> <select id="selectProOrderWorkorderList999" resultMap="ProOrderWorkorderResult">
@ -174,6 +212,12 @@
and del_flag = '0' and del_flag = '0'
</select> </select>
<select id="selectSonWorkOrder" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where parent_order = #{workorderCode}
and del_flag = '0'
</select>
<select id="selectEndWorkOrder" resultType="java.lang.String"> <select id="selectEndWorkOrder" resultType="java.lang.String">
select TOP 1 workorder_code select TOP 1 workorder_code
FROM pro_order_workorder FROM pro_order_workorder
@ -438,6 +482,14 @@
where workorder_code = #{workorderCode} where workorder_code = #{workorderCode}
and del_flag = '0' and del_flag = '0'
</select> </select>
<select id="getSonWorkOrder" resultMap="ProOrderWorkorderResult">
select workorder_id, workorder_code, order_id, order_code,
product_code, product_name, product_date, parent_order,
quantity_split,unit,prod_type, factory_code
from pro_order_workorder
where parent_order = #{workorderCode}
and del_flag = '0'
</select>
<select id="getWetMaterial" resultType="com.op.plan.domain.ProWetMaterialPlanDetail"> <select id="getWetMaterial" resultType="com.op.plan.domain.ProWetMaterialPlanDetail">
select top 1 material_code materialCode, select top 1 material_code materialCode,
material_name materialName material_name materialName

Loading…
Cancel
Save