Merge remote-tracking branch 'origin/master'

master
yangwl 3 years ago
commit 035d8c2c96

@ -410,13 +410,13 @@ public class AbnormalBillController {
abnormalBill.setType("Z");
abnormalBill.setReportFrom("J");
abnormalBill.setItemBo(HandleEnum.ITEM.getHandle(site,abnormalBill.getItemBo(),"A"));
abnormalBill.setReportSendUserGroup("BPM");
abnormalBill.setReportSendUserGroup("bpmUserGroup");
abnormalBill.setSite(site);
abnormalBill.setPbUser(abnormalBill.getPbUser());
abnormalBill.setResponseUser(abnormalBill.getPbUser());
abnormalBill.setResponseDateTime(now);
abnormalBillDispose.setSite(site);
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
com.foreverwin.modular.core.util.CommonMethods.setUser(abnormalBill.getPbUser());
abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,
ncCodesVO.getNcGroupAndNcCodes(), ncCodesVO.getDutyCauseType(), ncCodesVO.getDutyType());
return new ResultVo(ResultCode.SUCCESS,abnormalBill);
@ -443,7 +443,7 @@ public class AbnormalBillController {
try{
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
//abnormalBill.setBpmSubmit("true");
abnormalBill.setBpmSubmit("true");
abnormalBill.setItemBo(HandleEnum.ITEM.getHandle(site,abnormalBill.getItemBo(),"A"));
abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose);
return new ResultVo(ResultCode.SUCCESS,"BPM方案确认回传成功");

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.anomaly.controller;
import com.foreverwin.mesnac.anomaly.utils.DateReportUtils;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
@ -48,11 +49,13 @@ public class OutStoreController {
*/
@ResponseBody
@GetMapping("")
public R getOutStoreList(@RequestParam(required = false) OutStore outStore){
public R getOutStoreList(@RequestParam(required = false) OutStore outStore,String startDate,String endDate){
List<OutStore> result;
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
queryWrapper
.ge(!StringUtil.isBlank(startDate),"IMPORT_DATE_TIME", DateReportUtils.stringToDate(startDate + " 00:00:00","yyyy-MM-dd HH:mm:ss"))
.le(!StringUtil.isBlank(endDate),"IMPORT_DATE_TIME",DateReportUtils.stringToDate(endDate + " 23:59:59","yyyy-MM-dd HH:mm:ss"))
;
result = outStoreService.list(queryWrapper);
return R.ok(result);
}
@ -65,25 +68,13 @@ public class OutStoreController {
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<OutStore> frontPage, OutStore outStore){
public R page(FrontPage<OutStore> frontPage, OutStore outStore,String startDate,String endDate){
IPage result;
QueryWrapper<OutStore> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(outStore);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(OutStore::getHandle, frontPage.getGlobalQuery())
.or().like(OutStore::getFactory, frontPage.getGlobalQuery())
.or().like(OutStore::getStockLocation, frontPage.getGlobalQuery())
.or().like(OutStore::getProjectNo, frontPage.getGlobalQuery())
.or().like(OutStore::getItem, frontPage.getGlobalQuery())
.or().like(OutStore::getItemDescription, frontPage.getGlobalQuery())
.or().like(OutStore::getImportUser, frontPage.getGlobalQuery())
.or().like(OutStore::getOther1, frontPage.getGlobalQuery())
.or().like(OutStore::getOther2, frontPage.getGlobalQuery())
.or().like(OutStore::getOther3, frontPage.getGlobalQuery())
);
}
queryWrapper
.ge(!StringUtil.isBlank(startDate),"IMPORT_DATE_TIME", DateReportUtils.stringToDate(startDate + " 00:00:00","yyyy-MM-dd HH:mm:ss"))
.le(!StringUtil.isBlank(endDate),"IMPORT_DATE_TIME",DateReportUtils.stringToDate(endDate + " 23:59:59","yyyy-MM-dd HH:mm:ss"))
;
result = outStoreService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}

@ -126,8 +126,10 @@ public class TemporaryFixController {
temporaryFix.setCreatedBy(user);
temporaryFix.setUpdatedBy(user);
temporaryFix.setUpdatedTime(now);
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
if (temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null && temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null){
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
}
boolean result = temporaryFixService.save(temporaryFix);
return R.ok(result);
}
@ -139,8 +141,9 @@ public class TemporaryFixController {
String user = CommonMethods.getUser();
temporaryFix.setUpdatedBy(user);
temporaryFix.setUpdatedTime(now);
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
if (temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null && temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null){
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
}
boolean result = temporaryFixService.updateById(temporaryFix);
return R.ok(result);

@ -1,6 +1,7 @@
package com.foreverwin.mesnac.anomaly.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -287,21 +288,35 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
/**
* mesbpm
*/
// if (!StringUtil.isBlank(abnormalBill.getBpmSubmit()) && abnormalBill.getBpmSubmit().equals("false")) {
// //abnormalBill.setBpmSubmit("false");
// List<String> NcCodeGroupList = (List)abnormalBill.getNcCodeDesc().stream().map((e) -> {
// return e.split("/")[0];
// }).collect(Collectors.toList());
// abnormalBill.setPbUser(CommonMethods.getUser());
// YunBpmApiRes bpmApiRes = yunBpmService.saveQualitySystem(abnormalBill, abnormalBillDispose,
// String.join(";", NcCodeGroupList), String.join(";", abnormalBill.getNcCodeDesc()));
// if (!bpmApiRes.getErrCode().equals(0)) {
// throw new BaseException("MES提报给质量BPM系统失败");
// }
//
// String workflowInstanceId = JSON.parseObject(String.valueOf(bpmApiRes.getData())).getString("workflowInstanceId");
// abnormalBill.setBpmFlowId(workflowInstanceId);
// }
/* if (!StringUtil.isBlank(abnormalBill.getBpmSubmit()) && abnormalBill.getBpmSubmit().equals("false")) {
//产品类别
String productCategory = abnormalBill.getProductCategory();
DataField dataField = new DataField();
dataField.setDataField("PRODUCT_CATEGORY");
List<DataField> productCategoryList = dataFieldListService.findDataFieldListById(dataField);
for (int i = 0; i < productCategoryList.size(); i++) {
String dataValue = JSONArray.toJSONString(productCategoryList.get(i));
HashMap<String,String> fieldMap = JSON.parseObject(dataValue, HashMap.class);
if (fieldMap.get("dataValue").equals(abnormalBill.getProductCategory())){
abnormalBill.setProductCategory(fieldMap.get("description"));
}
}
List<String> NcCodeGroupList = (List)abnormalBill.getNcCodeDesc().stream().map((e) -> {
return e.split("/")[0];
}).collect(Collectors.toList());
abnormalBill.setPbUser(CommonMethods.getUser());
YunBpmApiRes bpmApiRes = yunBpmService.saveQualitySystem(abnormalBill, abnormalBillDispose,
String.join(";", NcCodeGroupList), String.join(";", abnormalBill.getNcCodeDesc()));
if (!bpmApiRes.getErrCode().equals(0)) {
throw new BaseException("MES提报给质量BPM系统失败");
}
String workflowInstanceId = JSON.parseObject(String.valueOf(bpmApiRes.getData())).getString("workflowInstanceId");
abnormalBill.setBpmFlowId(workflowInstanceId);
abnormalBill.setProductCategory(productCategory);
//abnormalBill.setStatus(Constants.RESPONSE);
//abnormalBill.setResponseUser(CommonMethods.getUser());
//abnormalBill.setResponseDateTime(now);
}*/
ArrayList<AbnormalNcCode> abnormalNcCodes = new ArrayList<>();
@ -346,7 +361,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
//发送消息
if(Constants.NEW.equals(abnormalBill.getStatus()) && !abnormalBill.getReportSendUserGroup().equals("BPM")){
if(Constants.NEW.equals(abnormalBill.getStatus()) && abnormalBill.getBpmSubmit().equals("false")){
this.anomalyCreatedAndSendMessage(abnormalBill,null);
}
@ -753,16 +768,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String local = LocaleContextHolder.getLocale().getLanguage();
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
// if (StringUtil.isBlank(abnormalBill.getBpmSubmit())){
// AbnormalBill aBill = new AbnormalBill();
// aBill.setAbnormalNo(abnormalBill.getAbnormalNo());
// List<AbnormalBill> abnormalBills = this.selectList(aBill);
// abnormalBills.get(0).setStatus(Constants.SHUT_DOWN);
// YunBpmApiRes bpmApiRes = yunBpmService.saveQualitySystem(abnormalBills.get(0), abnormalBillDispose, null, null);
// if (!bpmApiRes.getErrCode().equals(0)) {
// throw BusinessException.build("BPM闭环关闭失败");
// }
// }
/* if (StringUtil.isBlank(abnormalBill.getBpmSubmit())){
AbnormalBill aBill = new AbnormalBill();
aBill.setAbnormalNo(abnormalBill.getAbnormalNo());
List<AbnormalBill> abnormalBills = this.selectList(aBill);
abnormalBills.get(0).setStatus(Constants.SHUT_DOWN);
YunBpmApiRes bpmApiRes = yunBpmService.saveQualitySystem(abnormalBills.get(0), abnormalBillDispose, null, null);
if (!bpmApiRes.getErrCode().equals(0)) {
throw BusinessException.build("BPM闭环关闭失败");
}
}*/
if(!StringUtil.isBlank(abnormalBill.getStatus())){
abnormalBill.setStatus(abnormalBill.getStatus());

@ -111,6 +111,8 @@ public class ImprovementProposalsServiceImpl extends ServiceImpl<ImprovementProp
String fileType = req.getParameter("fileType");
String site = req.getParameter("site");
String user = req.getParameter("user");
CommonMethods.setSite(site);
CommonMethods.setUser(user);
try {
CommonMethods.setSite(site);
CommonMethods.setUser(user);

@ -787,9 +787,7 @@ public class ReportServiceImpl implements ReportService {
return "非公路";
}else if (career.indexOf("研究院") != -1) {
return "研究院";
}else if (career.indexOf("塞班") != -1) {
return "塞班";
} else {
}else if (career.indexOf("外部") != -1) {
return "外部";
}
} catch (Exception exception) {
@ -804,17 +802,23 @@ public class ReportServiceImpl implements ReportService {
ArrayList<String> shopOrderQTYs = new ArrayList<>();
ArrayList<String> doneQTY = new ArrayList<>();
ArrayList<String> rate = new ArrayList<>();
ArrayList<String> workOrderList = new ArrayList<>();
ArrayList<String> isLongTime = new ArrayList<>();
List<Map<String, String>> maps = workOrderMap.get(workOrder);
maps.forEach(e -> {
items.add(e.get("item"));
shopOrderQTYs.add(e.get("shopOrderQTY"));
doneQTY.add(e.get("doneQTY"));
rate.add(e.get("rate"));
workOrderList.add(e.get("workOrder"));
isLongTime.add(e.get("isLongTime"));
});
resultMap.put("items",items);
resultMap.put("shopOrderQTY",shopOrderQTYs);
resultMap.put("doneQTY",doneQTY);
resultMap.put("rate",rate);
resultMap.put("workOrder",workOrderList);
resultMap.put("isLongTime",isLongTime);
result.put(workOrder,resultMap);
}
return result;

@ -75,7 +75,9 @@ public class TemporaryFixServiceImpl extends ServiceImpl<TemporaryFixMapper, Tem
temporaryFix.setCreatedBy(user);
temporaryFix.setUpdatedBy(user);
temporaryFix.setUpdatedTime(now);
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
if (temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null && temporaryFix.getAmount() != null && temporaryFix.getSingleWorkHours() != null){
temporaryFix.setTotalWorkHours(String.valueOf(Float.valueOf(temporaryFix.getAmount()) * Float.valueOf(temporaryFix.getSingleWorkHours())));
}
}
return temporaryFixList;
} catch (Exception e) {
@ -99,8 +101,8 @@ public class TemporaryFixServiceImpl extends ServiceImpl<TemporaryFixMapper, Tem
CommonsMultipartFile multipartFile = new CommonsMultipartFile(fileItem);
List<TemporaryFix> temporaryFixList = ExcelUtils.readExcel(fileType, TemporaryFix.class, multipartFile, null);
temporaryFixList = this.temporaryFixImportFile(temporaryFixList);
if (temporaryFixList.equals(null)){
return R.failed("导入数据失败");
if (temporaryFixList.size() == 0){
return R.failed("导出数据失败0条数据");
}
boolean result = this.saveBatch(temporaryFixList);
return R.ok(result);

@ -71,14 +71,13 @@ public class YunBpmServiceImpl implements YunBpmService {
.product_barcode(abnormalBill.getSfc()).work_order(abnormalBill.getWorkOrder()).submit_date(DateUtil.getCurrentDate())
.item_number(abnormalBill.getItemNumber()).product_category(abnormalBill.getProductCategory())
.submission_users(abnormalBill.getReportSendUserGroup()).working_procedure_code(abnormalBill.getOperation())
.submission_man_employee_no(abnormalBill.getPbUser())
.submission_man_employee_no(abnormalBill.getPbUser()).test_user_employeeNo(abnormalBill.getInspector())
//不良明细
.problem_description(abnormalBill.getPbDescription()).problem_number(abnormalBill.getPbQty())
.discover_link(abnormalBill.getDiscover()).entity_location(abnormalBill.getEntityLocation())
.report_from(abnormalBill.getReportFrom()).rejects_number(abnormalBill.getNcQty())
.bad_code_group(ncGroup).bad_code(ncCode).problem_level(abnormalBill.getPbGrade())
// .problem_photos(null)
// .test_user_employeeNo(abnormalBill.getInspector()).submission_man_employeeNo(pbUserList)
//责任划分
.cause_analysis(abnormalBillDispose.getDutyCauseDescription()).reason_type(abnormalBillDispose.getDutyCauseType())
.responsibility_type(abnormalBillDispose.getDutyType()).responsibility_dept(abnormalBillDispose.getDutyDepart())

@ -1155,16 +1155,16 @@
WIP.shopOrderQTY "shopOrderQTY",
WIP.doneQTY "doneQTY",--已完成数量
WIP.rate || '%' "rate",
OT.DESCRIPTION "currentOperation",
zsd2.CURRENT_OPERATION "currentOperation",
WIP.nextOperationNum "nextOperationNum",
zsd2.PLANNED_COMP_DATE "currentPlanTime",
zsd3.PLANNED_COMP_DATE "currentPlanTime",
WIP.endPlanTime "endPlanTime",
WIP.rework "rework",--是否返修工序
CASE
WHEN WIP.nextOperationNum > 0 AND SYSDATE > zsd2.PLANNED_COMP_DATE AND zsd2.DISPATCH_STATUS != 'COMPLETE'
WHEN WIP.nextOperationNum > 0 AND SYSDATE > zsd3.PLANNED_COMP_DATE AND zsd3.DISPATCH_STATUS != 'COMPLETE'
THEN 'true'
WHEN WIP.nextOperationNum = 0 AND WIP.rate !=100.00 AND SYSDATE > zsd2.PLANNED_COMP_DATE AND
zsd2.DISPATCH_STATUS != 'COMPLETE'
WHEN WIP.nextOperationNum = 0 AND WIP.rate !=100.00 AND SYSDATE > zsd3.PLANNED_COMP_DATE AND
zsd3.DISPATCH_STATUS != 'COMPLETE'
THEN 'true'
ELSE 'false' END "isOverTime" --当前工序是否超时
FROM (SELECT cf.VALUE item,--项目号
@ -1174,20 +1174,20 @@
it.DESCRIPTION itemDescription,--物料描述
MAX(zsd.DISPATCH_QTY) shopOrderQTY,--订单数量
MIN(CASE
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' AND zsd.DISPATCH_STATUS = 'CANCEL' THEN
zsd.DISPATCH_QTY
ELSE 0 END) doneQTY, --已完成数量
TO_CHAR(
DECODE(SUM(CASE
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' AND zsd.DISPATCH_STATUS = 'CANCEL' THEN
zsd.PROD_HOURS * zsd.DISPATCH_QTY
ELSE 0 END), 0, 0, SUM(CASE
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' AND zsd.DISPATCH_STATUS = 'CANCEL' THEN
zsd.PROD_HOURS * zsd.DISPATCH_QTY
ELSE 0 END) / SUM(zsd.PROD_HOURS * zsd.DISPATCH_QTY))
* 100, '99990.99') rate,--进度(工时百分比)
MAX(zsd.ACTUAL_START_DATE) ACTUAL_START_DATE,--最大实际开始时间
SUM(CASE WHEN zsd.DISPATCH_STATUS != 'COMPLETE' THEN 1 ELSE 0 END) nextOperationNum,--剩余工序数量
SUM(CASE WHEN zsd.DISPATCH_STATUS != 'COMPLETE' AND zsd.DISPATCH_STATUS != 'CANCEL' THEN 1 ELSE 0 END) nextOperationNum,--剩余工序数量
MAX(zsd.PLANNED_COMP_DATE) endPlanTime,--计划最终交付时间
rs.REWORK rework,--是否返修工序
zsd.SITE SITE
@ -1201,16 +1201,25 @@
LEFT JOIN ROUTER r ON zsd.ROUTER_BO = R.HANDLE
LEFT JOIN ROUTER_STEP rs ON rs.ROUTER_BO = r.HANDLE AND rs.STEP_ID = zsd.STEP_ID
WHERE zsd.SITE = '1000'
AND zsd.DISPATCH_STATUS != 'CANCEL'
-- AND zsd.DISPATCH_STATUS != 'CANCEL'
AND cf.VALUE IS NOT NULL
AND cf2.VALUE IS NOT NULL
GROUP BY zsd.SITE, cf.VALUE, cf2.VALUE, zsd.SHOP_ORDER, zsd.SFC, it.DESCRIPTION, rs.REWORK
ORDER BY rate
) WIP
LEFT JOIN Z_SFC_DISPATCH zsd2 ON WIP.shopOrder = ZSD2.SHOP_ORDER AND WIP.SFC = zsd2.SFC
AND WIP.SITE = zsd2.SITE AND WIP.ACTUAL_START_DATE = zsd2.ACTUAL_START_DATE
INNER JOIN OPERATION O ON O.SITE = WIP.SITE AND O.OPERATION = zsd2.OPERATION AND O.CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh'
LEFT JOIN (SELECT zsd1.SITE,zsd1.SFC,MAX(zsd1.STEP_ID) STEP_ID,MAX(zsd1.CURRENT_OPERATION) CURRENT_OPERATION FROM (
SELECT zsd0.SITE,zsd0.SFC,OT.DESCRIPTION CURRENT_OPERATION,ss.STEP_ID
FROM Z_SFC_DISPATCH zsd0
LEFT JOIN SFC s2 ON s2.SFC = zsd0.SFC AND s2.SITE = zsd0.SITE
LEFT JOIN SFC_ROUTING sr ON sr.SFC_BO = s2.HANDLE
LEFT JOIN SFC_ROUTER st ON st.SFC_ROUTING_BO = sr.HANDLE AND st.IN_USE = 'true'
LEFT JOIN SFC_STEP ss ON ss.SFC_ROUTER_BO = st.HANDLE AND (ss.QTY_IN_QUEUE > 0 OR ss.QTY_IN_WORK > 0)
INNER JOIN OPERATION o
ON ss.OPERATION_BO = 'OperationBO:'||o.SITE||','||o.OPERATION||',#' AND o.CURRENT_REVISION = 'true' AND o.SITE = zsd0.SITE AND o.CURRENT_REVISION = 'true'
and zsd0.OPERATION = o.OPERATION
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = O.HANDLE AND OT.LOCALE = 'zh') zsd1
GROUP BY zsd1.SITE,zsd1.SFC) zsd2 ON WIP.SFC = zsd2.SFC AND WIP.SITE = zsd2.SITE
LEFT JOIN Z_SFC_DISPATCH zsd3 ON zsd3.SFC = zsd2.SFC AND zsd3.STEP_ID = zsd2.STEP_ID AND zsd3.SITE = zsd2.SITE
<where>
<if test="workOrder != null and finished == 'true'">
AND WIP.rate = 100.00
@ -1218,9 +1227,21 @@
<if test="workOrder != null and finished == 'false'">
AND WIP.rate != 100.00
</if>
<if test="careerKey != null and careerKey != ''">
AND WIP.workOrder like '%${careerKey}%'
</if>
<if test="item != null and item != ''">
AND WIP.item like '%${item}%'
</if>
<if test="workOrder != null and workOrder != ''">
AND WIP.workOrder like '%${workOrder}%'
</if>
<if test="shopOrder != null and shopOrder != ''">
AND WIP.shopOrder like '%${shopOrder}%'
</if>
<if test="SFC != null and SFC != ''">
AND WIP.SFC like '%${SFC}%'
</if>
</where>
ORDER BY endPlanTime DESC
</select>
@ -1369,7 +1390,7 @@
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN
zsd.PROD_HOURS * zsd.DISPATCH_QTY
ELSE 0 END), 0, 0, SUM(CASE
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' OR zsd.DISPATCH_STATUS != 'CANCEL' THEN
WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN
zsd.PROD_HOURS * zsd.DISPATCH_QTY
ELSE 0 END) / SUM(zsd.PROD_HOURS * zsd.DISPATCH_QTY) )
* 100, '99990.99') rate,--进度(工时百分比)
@ -1381,6 +1402,7 @@
LEFT JOIN CUSTOM_FIELDS cf ON cf.HANDLE = so.HANDLE AND cf."ATTRIBUTE" = 'ITEM_NUMBER'
LEFT JOIN CUSTOM_FIELDS cf2 ON cf2.HANDLE = so.HANDLE AND cf2."ATTRIBUTE" = 'WORK_ORDER'
WHERE zsd.SITE = '1000'
AND zsd.DISPATCH_STATUS != 'CANCEL'
AND cf.VALUE IS NOT NULL
AND cf2.VALUE IS NOT NULL
GROUP BY zsd.SITE, cf.VALUE, cf2.VALUE,zsd.SFC
@ -1397,18 +1419,23 @@
ORDER BY WIP."rate" DESC
</select>
<select id="projectPlanningProgress" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT *
--项目生产加工周期看板
SELECT WIP.*,
CASE WHEN (SYSDATE - WIP.ACTUAL_START_DATE) > 90 AND WIP."shopOrderQTY" != WIP."doneQTY" THEN 'ture'
ELSE 'false' END "isLongTime"
FROM (
SELECT OWIP.workOrder "workOrder",
OWIP.item "item",--项目号
SUM(OWIP.shopOrderQTY) "shopOrderQTY",
SUM(OWIP.doneQTY) "doneQTY",
TO_CHAR(SUM(OWIP.doneQTY) / SUM(OWIP.shopOrderQTY) * 100, '99990.99') "rate"
TO_CHAR(SUM(OWIP.doneQTY) / SUM(OWIP.shopOrderQTY) * 100, '99990.99') "rate",
MIN(OWIP.ACTUAL_START_DATE) ACTUAL_START_DATE
FROM (SELECT cf.VALUE item,--项目号
cf2.VALUE workOrder,--工作令
zsd.SFC,
MAX(zsd.DISPATCH_QTY) shopOrderQTY,--订单数量
MIN(CASE WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN zsd.DISPATCH_QTY ELSE 0 END ) doneQTY
MIN(CASE WHEN zsd.DISPATCH_STATUS = 'COMPLETE' THEN zsd.DISPATCH_QTY ELSE 0 END ) doneQTY,
MIN(zsd.ACTUAL_START_DATE) ACTUAL_START_DATE
FROM Z_SFC_DISPATCH zsd
LEFT JOIN SFC s ON s.SFC = zsd.SFC AND s.SITE = zsd.SITE
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zsd.SHOP_ORDER AND so.SITE = zsd.SITE
@ -1419,6 +1446,7 @@
AND cf2.VALUE IS NOT NULL
GROUP BY zsd.SITE, cf.VALUE, cf2.VALUE, zsd.SFC
) OWIP
WHERE OWIP.ACTUAL_START_DATE IS NOT NULL
GROUP BY OWIP.item, OWIP.workOrder
) WIP
<where>
@ -1526,83 +1554,84 @@
</where>
</select>
<select id="weekLoadRateReport" resultType="java.util.HashMap" parameterType="java.util.HashMap">
--资源负荷率报表(周维度)
SELECT CF.VALUE "weekCapacity",WIP.*,
WIP.RESOURCE_TYPE_DESCRIPTION "DESCRIPTION",
WIP.WORK_CENTER_DESCRIPTION "workCenterDescription",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours1" / CF.VALUE) * 100, '99990.99') || '%' "weekRate1",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours2" / CF.VALUE) * 100, '99990.99') || '%' "weekRate2",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours3" / CF.VALUE) * 100, '99990.99') || '%' "weekRate3",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours4" / CF.VALUE) * 100, '99990.99') || '%' "weekRate4",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours5" / CF.VALUE) * 100, '99990.99') || '%' "weekRate5",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours6" / CF.VALUE) * 100, '99990.99') || '%' "weekRate6",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours7" / CF.VALUE) * 100, '99990.99') || '%' "weekRate7",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours8" / CF.VALUE) * 100, '99990.99') || '%' "weekRate8"
FROM (WITH WEEK AS (
SELECT TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') WEEK0,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 1 WEEK1,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 2 WEEK2,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 3 WEEK3,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 4 WEEK4,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 5 WEEK5,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 6 WEEK6,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 7 WEEK7,
TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 8 WEEK8
FROM DUAL)
SELECT O.OPERATION "operation",
OT.DESCRIPTION "operationDescription",
RT.DESCRIPTION,
SUM(CASE
WHEN SYSDATE > ZSD.PLANNED_COMP_DATE THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "tardinessWork",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK0) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK1)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours1",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK1) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK2)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours2",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK2) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK3)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours3",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK3) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK4)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours4",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK4) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK5)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours5",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK5) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK6)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours6",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK6) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK7)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours7",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK7) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK8)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours8",
WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = ZSD.SITE
LEFT JOIN OPERATION_T OT ON O.HANDLE = OT.OPERATION_BO
LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = ZSD.WORK_CENTER
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
LEFT JOIN RESOURCE_TYPE RT ON ZSD.RESOURCE_TYPE = RT.RESOURCE_TYPE
CROSS JOIN WEEK
WHERE (ZSD.DISPATCH_STATUS != 'CANCEL' AND ZSD.DISPATCH_STATUS != 'PAUSE' AND ZSD.DISPATCH_STATUS != 'COMPLETE')
AND ZSD.PLANNED_COMP_DATE IS NOT NULL
-- AND ZSD.CREATED_DATE_TIME > TO_DATE(TRUNC(TO_DATE(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'),'IW') - 8 * 7)
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
GROUP BY O.OPERATION,OT.DESCRIPTION,WCT.DESCRIPTION,RT.DESCRIPTION
ORDER BY "tardinessWork" DESC ) WIP
LEFT JOIN CUSTOM_FIELDS CF ON CF.ATTRIBUTE ='WEEK_CAPACITY' AND CF.HANDLE = 'OperationBO:1000,'|| WIP."operation" || ',1.0'
<where>
1=1
<if test="operation != null and operation != ''">
AND WIP."operation" = #{operation}
</if>
<if test="operationDescription != null and operationDescription != ''">
AND WIP."operationDescription" = #{operationDescription}
--资源负荷率报表(周维度)
SELECT CF.VALUE "weekCapacity",WIP.*,
WIP.RESOURCE_TYPE_DESCRIPTION "DESCRIPTION",
WIP.WORK_CENTER_DESCRIPTION "workCenterDescription",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours1" / CF.VALUE) * 100, '99990.99') || '%' "weekRate1",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours2" / CF.VALUE) * 100, '99990.99') || '%' "weekRate2",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours3" / CF.VALUE) * 100, '99990.99') || '%' "weekRate3",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours4" / CF.VALUE) * 100, '99990.99') || '%' "weekRate4",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours5" / CF.VALUE) * 100, '99990.99') || '%' "weekRate5",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours6" / CF.VALUE) * 100, '99990.99') || '%' "weekRate6",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours7" / CF.VALUE) * 100, '99990.99') || '%' "weekRate7",
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."unWorkHours8" / CF.VALUE) * 100, '99990.99') || '%' "weekRate8"
FROM (WITH WEEK AS (
SELECT TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') WEEK0,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 1 WEEK1,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 2 WEEK2,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 3 WEEK3,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 4 WEEK4,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 5 WEEK5,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 6 WEEK6,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 7 WEEK7,
TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW') + 7 * 8 WEEK8
FROM DUAL)
SELECT O.OPERATION "operation",
OT.DESCRIPTION "operationDescription",
RT.DESCRIPTION,
SUM(CASE
WHEN TO_DATE(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM-dd'), 'yyyy-MM-dd'), 'IW')) > ZSD.PLANNED_COMP_DATE THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "tardinessWork",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK0) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK1)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours1",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK1) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK2)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours2",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK2) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK3)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours3",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK3) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK4)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours4",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK4) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK5)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours5",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK5) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK6)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours6",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK6) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK7)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours7",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(WEEK.WEEK7) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(WEEK.WEEK8)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "unWorkHours8",
WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = ZSD.SITE AND CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON O.HANDLE = OT.OPERATION_BO
LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = ZSD.WORK_CENTER
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
LEFT JOIN RESOURCE_TYPE RT ON ZSD.RESOURCE_TYPE = RT.RESOURCE_TYPE
CROSS JOIN WEEK
WHERE (ZSD.DISPATCH_STATUS != 'CANCEL' AND ZSD.DISPATCH_STATUS != 'PAUSE' AND ZSD.DISPATCH_STATUS != 'COMPLETE')
AND ZSD.PLANNED_COMP_DATE IS NOT NULL
-- AND ZSD.CREATED_DATE_TIME > TO_DATE(TRUNC(TO_DATE(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'),'IW') - 8 * 7)
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
GROUP BY O.OPERATION,OT.DESCRIPTION,WCT.DESCRIPTION,RT.DESCRIPTION
ORDER BY "tardinessWork" DESC ) WIP
LEFT JOIN OPERATION OP ON OP.OPERATION = WIP."operation" AND CURRENT_REVISION = 'true'
LEFT JOIN CUSTOM_FIELDS CF ON CF.ATTRIBUTE ='WEEK_CAPACITY' AND CF.HANDLE = OP.HANDLE
<where>
1=1
<if test="operation != null and operation != ''">
AND WIP."operation" = #{operation}
</if>
<if test="operationDescription != null and operationDescription != ''">
AND WIP."operationDescription" = #{operationDescription}
</if>
</where>
</select>
@ -1626,25 +1655,24 @@
TO_CHAR(DECODE(CF.VALUE,NULL,0, WIP."workHours12" / CF.VALUE) * 100, '99990.99') || '%' "monthRate12"
FROM (
WITH MONTH AS (
SELECT ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 0 - #{month}) month0,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 1- #{month}) month1,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 2- #{month}) month2,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 3- #{month}) month3,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 4- #{month}) month4,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 5- #{month}) month5,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 6- #{month}) month6,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 7- #{month}) month7,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 8- #{month}) month8,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 9- #{month}) month9,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 10- #{month}) month10,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 11- #{month}) month11,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 12- #{month}) month12
SELECT ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 0 - #{month}) month0,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 1- #{month}) month1,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 2- #{month}) month2,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 3- #{month}) month3,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 4- #{month}) month4,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 5- #{month}) month5,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 6- #{month}) month6,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 7- #{month}) month7,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 8- #{month}) month8,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 9- #{month}) month9,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 10- #{month}) month10,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 11- #{month}) month11,
ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(sysdate - 8/24, 'yyyy-MM'), 'yyyy-MM'), 'yyyy'), 12- #{month}) month12
FROM DUAL)
SELECT O.OPERATION "operation",
OT.DESCRIPTION "operationDescription",
SUM(CASE
WHEN SYSDATE > ZSD.PLANNED_COMP_DATE AND ZSD.DISPATCH_STATUS != 'COMPLETE'
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "tardinessWork",
WHEN TO_DATE(trunc(sysdate - 8/24,'month')) > ZSD.PLANNED_COMP_DATE THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "tardinessWork",
SUM(CASE
WHEN ZSD.PLANNED_COMP_DATE >= TO_DATE(MONTH.month0) AND ZSD.PLANNED_COMP_DATE &lt;= TO_DATE(MONTH.month1)
THEN ZSD.DISPATCH_QTY * ZSD.PROD_HOURS ELSE 0 END) "workHours1",
@ -1684,20 +1712,21 @@
WCT.DESCRIPTION WORK_CENTER_DESCRIPTION,
RT.DESCRIPTION RESOURCE_TYPE_DESCRIPTION
FROM Z_SFC_DISPATCH ZSD
LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = ZSD.SITE
LEFT JOIN OPERATION O ON O.OPERATION = ZSD.OPERATION AND O.SITE = ZSD.SITE AND CURRENT_REVISION = 'true'
LEFT JOIN OPERATION_T OT ON O.HANDLE = OT.OPERATION_BO
LEFT JOIN WORK_CENTER WC ON WC.WORK_CENTER = ZSD.WORK_CENTER
LEFT JOIN WORK_CENTER_T WCT ON WCT.WORK_CENTER_BO = WC.HANDLE
LEFT JOIN RESOURCE_TYPE RT ON ZSD.RESOURCE_TYPE = RT.RESOURCE_TYPE
CROSS JOIN MONTH
WHERE (ZSD.DISPATCH_STATUS != 'CANCEL' AND ZSD.DISPATCH_STATUS != 'PAUSE')
WHERE (ZSD.DISPATCH_STATUS != 'CANCEL' AND ZSD.DISPATCH_STATUS != 'PAUSE' AND ZSD.DISPATCH_STATUS != 'COMPLETE')
AND ZSD.PLANNED_COMP_DATE IS NOT NULL
<if test="workCenter != null and workCenter != ''">
AND ZSD.WORK_CENTER = #{workCenter}
</if>
GROUP BY O.OPERATION,OT.DESCRIPTION,WCT.DESCRIPTION,RT.DESCRIPTION
ORDER BY O.OPERATION DESC ) WIP
LEFT JOIN CUSTOM_FIELDS CF ON CF.ATTRIBUTE ='MONTH_CAPACITY' AND CF.HANDLE = 'OperationBO:1000,'|| WIP."operation" || ',1.0'
LEFT JOIN OPERATION OP ON OP.OPERATION = WIP."operation" AND CURRENT_REVISION = 'true'
LEFT JOIN CUSTOM_FIELDS CF ON CF.ATTRIBUTE ='MONTH_CAPACITY' AND CF.HANDLE = OP.HANDLE
<where>
1=1
<if test="operation != null and operation != ''">
@ -1836,7 +1865,7 @@
AND cf.VALUE IS NOT NULL
AND cf2.VALUE IS NOT NULL
<if test="item != null and item != ''">
AND cf.VALUE = #{item}
AND cf.VALUE LIKE '%${item}%'
</if>
<if test="career != null and career != ''">
AND cf2.VALUE LIKE '%${career}%'

@ -38,7 +38,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, ENTRUST_DATE, ENTRUST_UNIT, DUTY_PERSON, DUTY_REASON, PROJECT_NUMBER, QUALITY_REVIEW_NUMBER, WORK_CONTACT_NUMBER, MATERIAL_CODE, MATERIAL_NAME, MAP_NO, AMOUNT, SINGLE_WORK_HOURS, TOTAL_WORK_HOURS, MACHINE_HOURS, OPERATOR, USE_DEVICE, DEVICE_TYPE, COST_CENTER, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, UPLOAD_CENTER, UPLOAD_USER, CLASSIFY, DUTY_CLASSIFY, EMPLOY_PROPERTY, CENTER_CODE,ROWNUM SEQ
HANDLE, SITE, ENTRUST_DATE, ENTRUST_UNIT, DUTY_PERSON, DUTY_REASON, PROJECT_NUMBER, QUALITY_REVIEW_NUMBER, WORK_CONTACT_NUMBER, MATERIAL_CODE, MATERIAL_NAME, MAP_NO, AMOUNT, SINGLE_WORK_HOURS, TOTAL_WORK_HOURS, MACHINE_HOURS, OPERATOR, USE_DEVICE, DEVICE_TYPE, COST_CENTER, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, UPLOAD_CENTER, UPLOAD_USER, CLASSIFY, DUTY_CLASSIFY, EMPLOY_PROPERTY, CENTER_CODE,row_number() over (ORDER BY ENTRUST_DATE DESC ) SEQ
</sql>
<!-- BaseMapper标准查询/修改/删除 -->

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.enums.HandleEnum;
import com.foreverwin.mesnac.meapi.model.CustomFields;
import com.foreverwin.mesnac.meapi.model.Operation;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.mesnac.meapi.service.CustomFieldsService;
import com.foreverwin.mesnac.meapi.service.OperationService;
import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
@ -30,6 +32,9 @@ public class ResrceController {
@Autowired
public ResrceService resrceService;
@Autowired
OperationService operationService;
@Autowired
private CustomFieldsService customFieldsService;
@ -241,7 +246,8 @@ public class ResrceController {
if (paramMap.get("capacity").equals("weekCapacity")) {
for (HashMap<String, String> hashMap : resultList) {
CustomFields customFields = new CustomFields();
customFields.setHandle(HandleEnum.OPERATION.getHandle(CommonMethods.getSite(), hashMap.get("operation"),"1.0"));
Operation operation = operationService.getCurrentRevisionRef(CommonMethods.getSite(), hashMap.get("operation"));
customFields.setHandle(operation.getHandle());
customFields.setAttribute("WEEK_CAPACITY");
customFields.setValue(hashMap.get("weekCapacity"));
CustomFieldsList.add(customFields);
@ -249,7 +255,8 @@ public class ResrceController {
} else if (paramMap.get("capacity").equals("monthCapacity")){
for (HashMap<String, String> hashMap : resultList) {
CustomFields customFields = new CustomFields();
customFields.setHandle(HandleEnum.OPERATION.getHandle(CommonMethods.getSite(), hashMap.get("operation"),"1.0"));
Operation operation = operationService.getCurrentRevisionRef(CommonMethods.getSite(), hashMap.get("operation"));
customFields.setHandle(operation.getHandle());
customFields.setAttribute("MONTH_CAPACITY");
customFields.setValue(hashMap.get("monthCapacity"));
CustomFieldsList.add(customFields);
@ -257,7 +264,8 @@ public class ResrceController {
}else if (paramMap.get("capacity").equals("dayCapacity")){
for (HashMap<String, String> hashMap : resultList) {
CustomFields customFields = new CustomFields();
customFields.setHandle(HandleEnum.OPERATION.getHandle(CommonMethods.getSite(), hashMap.get("operation"),"1.0"));
Operation operation = operationService.getCurrentRevisionRef(CommonMethods.getSite(), hashMap.get("operation"));
customFields.setHandle(operation.getHandle());
customFields.setAttribute("DAY_CAPACITY");
customFields.setValue(hashMap.get("dayCapacity"));
CustomFieldsList.add(customFields);

Loading…
Cancel
Save