diff --git a/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp b/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp index 8cdcce7..097949c 100644 --- a/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp +++ b/WebContent/WEB-INF/views/rm/unFinishWorkList.jsp @@ -178,8 +178,28 @@ JY.Model.info("您没有选择任何内容!"); return; } - console.log("selectedValues:", selectedValues); - + + let pizhun=[]; + let shenhe=[]; + + for (var i = 0; i < selectedValues.length; i++) { + const item = selectedValues[i]; // 缓存当前元素,代码更简洁 + console.log('当前遍历元素:', item); + // 核心:判断字符串是否包含「新购任务审核」,includes返回布尔值 + if (item.includes('新购任务审核')) { + shenhe.push(item); // 符合条件,推入xingo + } else if (item.includes('新购任务批准')){ + pizhun.push(item); // 不符合,推入shenhe + } + } + console.log('当前遍历元素:', pizhun); + console.log('当前遍历元素:', shenhe); + if(shenhe.length>0){ + aduitFunction(shenhe); + } + if(pizhun.length>0){ + pizhunFunction(pizhun); + } $.ajax({ type: 'POST', url: bonuspath + '/backstage/rm/taskRecord/batchApproval', @@ -196,6 +216,42 @@ } }); }); + //审核 + function aduitFunction(shenhe){ + console.log(shenhe) + $.ajax({ + type: 'POST', + url: bonuspath + '/backstage/new/isExamines', + traditional: true, + data: { id: shenhe.join(",") }, + success: function(data) { + dataNum++; + }, + error: function(xhr) { + console.error("请求失败,状态码:", xhr.status); + console.error("响应内容:", xhr.responseText); + } + }); + } + + function pizhunFunction(pizhun){ + console.log(pizhun) + $.ajax({ + type: 'POST', + url: bonuspath + '/backstage/new/isApprovals', + traditional: true, + data: { id: pizhun.join(",") }, + success: function(data) { + + }, + error: function(xhr) { + console.error("请求失败,状态码:", xhr.status); + console.error("响应内容:", xhr.responseText); + } + }); + + } + // 全选逻辑 $('#checkAll').on('click', function(e) { diff --git a/WebContent/static/js/bm/ip_utils.js b/WebContent/static/js/bm/ip_utils.js index 8481178..3f89f80 100644 --- a/WebContent/static/js/bm/ip_utils.js +++ b/WebContent/static/js/bm/ip_utils.js @@ -6,9 +6,9 @@ let AQGQJ_IP='http://10.1.0.142:1999'; let AQGQJ_HTML_IP='http://10.1.0.142:1999/gz-aqgqj/'; //车辆 后端请求IP -let CAR_IP='http://192.168.0.38:21522'; +let CAR_IP='http://127.0.0.1:21522'; //车辆 跳转页面IP -let CAR_HTML_IP='http://192.168.0.38:8848/gz_car_ui/'; +let CAR_HTML_IP='http://127.0.0.1:8848/gz_car_ui/'; // dev -生产 diff --git a/resources/mybatis/index/IndexHomeDetailsMapper.xml b/resources/mybatis/index/IndexHomeDetailsMapper.xml index ac409fd..03f7af0 100644 --- a/resources/mybatis/index/IndexHomeDetailsMapper.xml +++ b/resources/mybatis/index/IndexHomeDetailsMapper.xml @@ -2,705 +2,705 @@ - + - + - + select * from ( + SELECT + rs.typeId, + mat2.`NAME` maType, + mat1.`NAME` maName, + mat1.UNIT as maUnit, + SUM(rs.storageNum)+SUM(rs.inuseNum) +SUM(rs.repairNum) as maTotal, + SUM(rs.storageNum) storageNum, + SUM(rs.inuseNum) inuseNum, + SUM(rs.repairNum) repairNum, + SUM(rs.scrapNum) scrapNum, + SUM(rs.projectNum) projectNum, + SUM(rs.inuseCount) inuseCount, + SUM(rs.backCount) backCount, + SUM(rs.pyNum) as pyNum, + SUM(rs.pkNum) as pkNum, + rs.isCount + FROM + ( + SELECT + mat1.ID AS typeId, + mat1.NUM storageNum, + 0 inuseNum, + 0 repairNum, + 0 scrapNum, + 0 projectNum, + 0 inuseCount, + 0 backCount, + 0 as pyNum, + 0 as pkNum, + mat1.IS_COUNT AS isCount + FROM + mm_type mat1 + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + WHERE + mat1.`LEVEL` = 4 + AND mat1.IS_ACTIVE = '1' + GROUP BY + mat1.ID + UNION - SELECT - typeId, - 0 storageNum, - sum( leaseNum ) - SUM( backNum ) inuseNum, - 0 repairNum, - 0 scrapNum, - 0 projectNum, - sum( leaseNum ) inuseCount, - SUM( backNum ) backCount, - 0 as pyNum, - 0 as pkNum, - isCount AS isCount - FROM - ( - SELECT - mmt1.`NAME` AS pMachineName, - mmt.`NAME` AS machineName, - mt.`NAME` AS machineModel, - mt.ID AS typeId, - mt.BUY_PRICE AS buyPrice, - mt.UNIT, - SUM( wir.NUM ) AS leaseNum, - 0 AS backNum, - mt.IS_COUNT AS isCount - FROM - wf_info_record wir - LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID - LEFT JOIN wf_task_record wtr2 ON wtr.SUP_ID = wtr2.ID - LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID - LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID - LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID - LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID - AND wcd.MODEL_ID = wir.MODEL_ID - WHERE - wir.TYPE = 2 - AND wtr2.IS_ACTIVE = 1 - AND wcd.IS_APPROVAL = 1 - GROUP BY - mt.ID UNION - SELECT - mmt1.`NAME` AS pMachineName, - mmt.`NAME` AS machineName, - mt.`NAME` AS machineModel, - mt.ID AS typeId, - mt.BUY_PRICE AS buyPrice, - mt.UNIT, - 0 AS leaseNum, - SUM( wir.NUM ) AS backNum, - mt.IS_COUNT AS isCount - FROM - wf_info_record wir - LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID - LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID - LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID - LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID - LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID - WHERE - wir.TYPE = 4 - AND wtr.IS_ACTIVE = 1 - GROUP BY - mt.ID - ) a - GROUP BY - typeId - UNION + SELECT + typeId, + 0 storageNum, + sum( leaseNum ) - SUM( backNum ) inuseNum, + 0 repairNum, + 0 scrapNum, + 0 projectNum, + sum( leaseNum ) inuseCount, + SUM( backNum ) backCount, + 0 as pyNum, + 0 as pkNum, + isCount AS isCount + FROM + ( + SELECT + mmt1.`NAME` AS pMachineName, + mmt.`NAME` AS machineName, + mt.`NAME` AS machineModel, + mt.ID AS typeId, + mt.BUY_PRICE AS buyPrice, + mt.UNIT, + SUM( wir.NUM ) AS leaseNum, + 0 AS backNum, + mt.IS_COUNT AS isCount + FROM + wf_info_record wir + LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID + LEFT JOIN wf_task_record wtr2 ON wtr.SUP_ID = wtr2.ID + LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID + LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID + LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID + LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID + AND wcd.MODEL_ID = wir.MODEL_ID + WHERE + wir.TYPE = 2 + AND wtr2.IS_ACTIVE = 1 + AND wcd.IS_APPROVAL = 1 + GROUP BY + mt.ID UNION + SELECT + mmt1.`NAME` AS pMachineName, + mmt.`NAME` AS machineName, + mt.`NAME` AS machineModel, + mt.ID AS typeId, + mt.BUY_PRICE AS buyPrice, + mt.UNIT, + 0 AS leaseNum, + SUM( wir.NUM ) AS backNum, + mt.IS_COUNT AS isCount + FROM + wf_info_record wir + LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID + LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID + LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID + LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID + LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID + WHERE + wir.TYPE = 4 + AND wtr.IS_ACTIVE = 1 + GROUP BY + mt.ID + ) a + GROUP BY + typeId + UNION - SELECT - typeId, - 0 storageNum, - 0 inuseNum, - SUM(repairNum) + SUM(checkNum) + SUM(waitInputNum) as repairNum, - 0 scrapNum, - 0 projectNum, - 0 inuseCount, - 0 backCount, - 0 as pyNum, - 0 as pkNum, - isCount - FROM - ( + SELECT + typeId, + 0 storageNum, + 0 inuseNum, + SUM(repairNum) + SUM(checkNum) + SUM(waitInputNum) as repairNum, + 0 scrapNum, + 0 projectNum, + 0 inuseCount, + 0 backCount, + 0 as pyNum, + 0 as pkNum, + isCount + FROM + ( - SELECT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - SUM( wrd.REPAIR_NUM ) - SUM( wrd.ALREPAIR_NUM ) - SUM( SCRAP_NUM ) AS repairNum, - 0 checkNum, - 0 scrapNum, - 0 loseNum, - 0 waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_repair_details wrd - LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - GROUP BY - wrd.MODEL_ID - UNION - SELECT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - 0 repairNum, - SUM( wrc.CHECK_NUM ) - SUM( wrc.ALCHECK_NUM ) AS checkNum, - 0 scrapNum, - 0 loseNum, - 0 waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_repair_check wrc - LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - GROUP BY - wrc.MODEL_ID - UNION - SELECT DISTINCT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - 0 repairNum, - 0 checkNum, - 0 AS scrapNum, - 0 loseNum, - SUM( - IFNULL( PRE_PUT_NUM, 0 )) - sum( - IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_put_storage_details wpd - LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - WHERE - wpd.IS_SURE = 0 - GROUP BY - wpd.MODEL_ID + SELECT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + SUM( wrd.REPAIR_NUM ) - SUM( wrd.ALREPAIR_NUM ) - SUM( SCRAP_NUM ) AS repairNum, + 0 checkNum, + 0 scrapNum, + 0 loseNum, + 0 waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_repair_details wrd + LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + GROUP BY + wrd.MODEL_ID + UNION + SELECT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + 0 repairNum, + SUM( wrc.CHECK_NUM ) - SUM( wrc.ALCHECK_NUM ) AS checkNum, + 0 scrapNum, + 0 loseNum, + 0 waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_repair_check wrc + LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + GROUP BY + wrc.MODEL_ID + UNION + SELECT DISTINCT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + 0 repairNum, + 0 checkNum, + 0 AS scrapNum, + 0 loseNum, + SUM( + IFNULL( PRE_PUT_NUM, 0 )) - sum( + IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_put_storage_details wpd + LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + WHERE + wpd.IS_SURE = 0 + GROUP BY + wpd.MODEL_ID - ) res - GROUP BY typeId - UNION - SELECT - mat1.ID AS typeId, - 0 storageNum, - 0 inuseNum, - 0 as repairNum, - SUM( wsd.ALSCRAP_NUM ) AS scrapNum , - 0 projectNum, - 0 inuseCount, - 0 backCount, - 0 as pyNum, - 0 as pkNum, - mat1.IS_COUNT AS isCount - FROM - wf_scrap_details wsd - LEFT JOIN mm_type mat1 ON wsd.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - WHERE - wsd.IS_SURE = 1 - GROUP BY - wsd.MODEL_ID - UNION + ) res + GROUP BY typeId + UNION + SELECT + mat1.ID AS typeId, + 0 storageNum, + 0 inuseNum, + 0 as repairNum, + SUM( wsd.ALSCRAP_NUM ) AS scrapNum , + 0 projectNum, + 0 inuseCount, + 0 backCount, + 0 as pyNum, + 0 as pkNum, + mat1.IS_COUNT AS isCount + FROM + wf_scrap_details wsd + LEFT JOIN mm_type mat1 ON wsd.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + WHERE + wsd.IS_SURE = 1 + GROUP BY + wsd.MODEL_ID + UNION - SELECT - mps.type AS typeId, - 0 storageNum, - 0 inuseNum, - 0 as repairNum, - 0 AS scrapNum , - COUNT(DISTINCT wla.PROJECT) as projectNum , - 0 inuseCount, - 0 backCount, - 0 as pyNum, - 0 as pkNum, - mat1.IS_COUNT AS isCount - FROM - ma_type_project_storage mps - LEFT JOIN wf_lease_agreement wla on mps.agreement_id = wla.ID - LEFT JOIN mm_type mat1 ON mps.type = mat1.ID - WHERE mps.`status` = 1 - GROUP BY mps.type - UNION - SELECT - typeId, - 0 storageNum, - 0 inuseNum, - 0 as repairNum, - 0 AS scrapNum , - 0 as projectNum , - 0 inuseCount, - 0 backCount, - SUM(pyNum) as pyNum, - SUM(pkNum) as pkNum, - isCount - FROM - ( - SELECT - mli.TYPE_ID as typeId, - mli.IS_PROFIT as type, - IF(mli.IS_PROFIT =1,SUM(mli.IN_NUMS),0) as pyNum, - IF(mli.IS_PROFIT =0,SUM(mli.IN_NUMS),0) as pkNum, - mat1.IS_COUNT AS isCount - FROM - ma_lib_inventroy mli - LEFT JOIN mm_type mat1 ON mli.TYPE_ID = mat1.ID - GROUP BY mli.TYPE_ID,mli.IS_PROFIT - ) res - GROUP BY typeId - ) rs - LEFT JOIN mm_type mat1 ON rs.typeId = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - - - and mat1.`NAME` like concat ('%',#{maName},'%') - - - and mat2.`NAME` like concat ('%',#{maType},'%') - - - and rs.isCount = #{isCount} - - - GROUP BY rs.typeId - ) a WHERE - typeId IN ( - SELECT DISTINCT - mt.ID - FROM - mm_type mt - WHERE - mt.`LEVEL` = 4 - AND mt.IS_ACTIVE = 1 - ) + SELECT + mps.type AS typeId, + 0 storageNum, + 0 inuseNum, + 0 as repairNum, + 0 AS scrapNum , + COUNT(DISTINCT wla.PROJECT) as projectNum , + 0 inuseCount, + 0 backCount, + 0 as pyNum, + 0 as pkNum, + mat1.IS_COUNT AS isCount + FROM + ma_type_project_storage mps + LEFT JOIN wf_lease_agreement wla on mps.agreement_id = wla.ID + LEFT JOIN mm_type mat1 ON mps.type = mat1.ID + WHERE mps.`status` = 1 + GROUP BY mps.type + UNION + SELECT + typeId, + 0 storageNum, + 0 inuseNum, + 0 as repairNum, + 0 AS scrapNum , + 0 as projectNum , + 0 inuseCount, + 0 backCount, + SUM(pyNum) as pyNum, + SUM(pkNum) as pkNum, + isCount + FROM + ( + SELECT + mli.TYPE_ID as typeId, + mli.IS_PROFIT as type, + IF(mli.IS_PROFIT =1,SUM(mli.IN_NUMS),0) as pyNum, + IF(mli.IS_PROFIT =0,SUM(mli.IN_NUMS),0) as pkNum, + mat1.IS_COUNT AS isCount + FROM + ma_lib_inventroy mli + LEFT JOIN mm_type mat1 ON mli.TYPE_ID = mat1.ID + GROUP BY mli.TYPE_ID,mli.IS_PROFIT + ) res + GROUP BY typeId + ) rs + LEFT JOIN mm_type mat1 ON rs.typeId = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + + + and mat1.`NAME` like concat ('%',#{maName},'%') + + + and mat2.`NAME` like concat ('%',#{maType},'%') + + + and rs.isCount = #{isCount} + + + GROUP BY rs.typeId + ) a WHERE + typeId IN ( + SELECT DISTINCT + mt.ID + FROM + mm_type mt + WHERE + mt.`LEVEL` = 4 + AND mt.IS_ACTIVE = 1 + ) - + SELECT "修试后入库" as taskType, wir.NUM as `content`, pu.`NAME` as userName, wir.TIME as currentDate - FROM + FROM wf_info_record wir - LEFT JOIN wf_put_storage_details wps on wir.SUP_ID = wps.TASK_ID - LEFT JOIN pm_user pu on wps.CUSTOMER_SERVICE_REP = pu.ID - WHERE wir.TYPE = 3 and wps.IS_SURE = 1 - and wir.model_id = #{typeId} - ORDER BY wir.TIME DESC - LIMIT 1 + LEFT JOIN wf_put_storage_details wps on wir.SUP_ID = wps.TASK_ID + LEFT JOIN pm_user pu on wps.CUSTOMER_SERVICE_REP = pu.ID + WHERE wir.TYPE = 3 and wps.IS_SURE = 1 + and wir.model_id = #{typeId} + ORDER BY wir.TIME DESC + LIMIT 1 - + SELECT + "新购入库" as taskType, + wir.NUM as `content`, + wnd.CUSTOMER_SERVICE_REP, + pu.`NAME` as userName, + wir.TIME as currentDate + FROM + wf_info_record wir LEFT JOIN wf_new_details wnd on wir.SUP_ID = wnd.TASK_ID LEFT JOIN pm_user pu on wnd.CUSTOMER_SERVICE_REP = pu.ID - WHERE wir.TYPE = 5 and wnd.IS_APPROVAL = 1 - and wir.model_id = #{typeId} - ORDER BY wir.TIME DESC - LIMIT 1 + WHERE wir.TYPE = 5 and wnd.IS_APPROVAL = 1 + and wir.model_id = #{typeId} + ORDER BY wir.TIME DESC + LIMIT 1 - + SELECT "领料出库" as taskType, wir.NUM as `content`, wot.OUT_PERSON, pu.`NAME` as userName, wir.TIME as currentDate - FROM + FROM wf_info_record wir - LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID - LEFT JOIN pm_user pu on wot.OUT_PERSON = pu.ID - WHERE wir.TYPE =2 and wot.IS_APPROVAL = 1 - and wir.model_id = #{typeId} - ORDER BY wir.TIME DESC - LIMIT 1 + LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID + LEFT JOIN pm_user pu on wot.OUT_PERSON = pu.ID + WHERE wir.TYPE =2 and wot.IS_APPROVAL = 1 + and wir.model_id = #{typeId} + ORDER BY wir.TIME DESC + LIMIT 1 - + SELECT wrd.ID, "退料申请" as taskType, wir.NUM as `content`, wrd.OPERATOR as userName, wir.TIME as currentDate - FROM + FROM wf_return_material_details wrd - LEFT JOIN wf_info_record wir on wir.SUP_ID = wrd.ID - WHERE wrd.IS_APPROVAL = 1 AND wir.TYPE = 4 - and wir.model_id = #{typeId} - ORDER BY wir.TIME DESC - LIMIT 1 + LEFT JOIN wf_info_record wir on wir.SUP_ID = wrd.ID + WHERE wrd.IS_APPROVAL = 1 AND wir.TYPE = 4 + and wir.model_id = #{typeId} + ORDER BY wir.TIME DESC + LIMIT 1 - + SELECT "机具报废" as taskType, wsd.SCRAP_NUM as `content`, pu.`NAME` as userName, wsd.SCRAP_TIME as currentDate - FROM + FROM wf_scrap_details wsd - LEFT JOIN pm_user pu on wsd.SCRAP_PERSON = pu.ID - WHERE wsd.IS_SURE = 1 and wsd.model_id = #{typeId} - ORDER BY wsd.SCRAP_TIME DESC - LIMIT 1 + LEFT JOIN pm_user pu on wsd.SCRAP_PERSON = pu.ID + WHERE wsd.IS_SURE = 1 and wsd.model_id = #{typeId} + ORDER BY wsd.SCRAP_TIME DESC + LIMIT 1 - + SELECT + wir.INVENTORY_TYPE as taskType, + wir.ID, + wir.INVENTORY_PERSON AS userName, + wir.INVENTORY_NUM as `content`, + wir.INVENTORY_TIME currentDate + FROM + wf_inventory_record wir + WHERE wir.INVENTORY_NUM > 0 AND wir.model_id = #{typeId} + ORDER BY wir.INVENTORY_TIME DESC + LIMIT 1 - + SELECT + a.id as id, + pu.`NAME` as userName, + wmo.OUT_TIME as currentDate, projectName, taskId, SUM( leaseNum ) - SUM( backNum ) inuseNum FROM ( - SELECT - MAX(wte.ID ) AS taskId, - wla.PROJECT as id, - bp.`NAME` AS projectName, - wla.`CODE` AS agreementCode, - SUM( wir.NUM ) AS leaseNum, - "0" AS backNum, - wla.ID AS agreementId - FROM - wf_task_record wtr - LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID - LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID + SELECT + MAX(wte.ID ) AS taskId, + wla.PROJECT as id, + bp.`NAME` AS projectName, + wla.`CODE` AS agreementCode, + SUM( wir.NUM ) AS leaseNum, + "0" AS backNum, + wla.ID AS agreementId + FROM + wf_task_record wtr + LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID - LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID - LEFT JOIN wf_task_record wte ON wtr.ID = wte.SUP_ID - LEFT JOIN wf_info_record wir ON wte.ID = wir.SUP_ID - WHERE - wir.TYPE = 2 AND wir.model_id = #{typeId} - AND wtr.IS_ACTIVE = 1 - GROUP BY - wla.ID + LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID + LEFT JOIN wf_task_record wte ON wtr.ID = wte.SUP_ID + LEFT JOIN wf_info_record wir ON wte.ID = wir.SUP_ID + WHERE + wir.TYPE = 2 AND wir.model_id = #{typeId} + AND wtr.IS_ACTIVE = 1 + GROUP BY + wla.ID - UNION - SELECT - 0 AS taskId, - wla.PROJECT as id, - bp.`NAME` AS projectName, - wla.`CODE` AS agreementCode, - "0" AS leaseNum, - SUM( wir.NUM ) AS backNum, - wla.ID AS agreementId - FROM - wf_task_record wtr - LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID - LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID + UNION + SELECT + 0 AS taskId, + wla.PROJECT as id, + bp.`NAME` AS projectName, + wla.`CODE` AS agreementCode, + "0" AS leaseNum, + SUM( wir.NUM ) AS backNum, + wla.ID AS agreementId + FROM + wf_task_record wtr + LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID - LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID - LEFT JOIN wf_return_material_details wrd ON wtr.ID = wrd.TASK_ID - LEFT JOIN wf_info_record wir ON wrd.ID = wir.SUP_ID - WHERE - wir.TYPE = 4 AND wir.model_id = #{typeId} - AND wtr.IS_ACTIVE = 1 - GROUP BY - wla.ID + LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID + LEFT JOIN wf_return_material_details wrd ON wtr.ID = wrd.TASK_ID + LEFT JOIN wf_info_record wir ON wrd.ID = wir.SUP_ID + WHERE + wir.TYPE = 4 AND wir.model_id = #{typeId} + AND wtr.IS_ACTIVE = 1 + GROUP BY + wla.ID ) a - LEFT JOIN wf_ma_outstock wmo on a.taskId = wmo.TASK_ID - LEFT JOIN pm_user pu on wmo.OUT_PERSON = pu.ID + LEFT JOIN wf_ma_outstock wmo on a.taskId = wmo.TASK_ID + LEFT JOIN pm_user pu on wmo.OUT_PERSON = pu.ID GROUP BY a.projectName - - - - - - - SELECT - wsd.TASK_ID as id , - wtr.NUMBER as taskCode, - pu.`NAME` as userName, - GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wsd.SCRAP_NUM) as content , - LEFT(wsd.SCRAP_TIME,10) as currentDate, - wsd.SCRAP_TIME as currentTime + wtr2.ID, + wtr2.NUMBER AS taskCode, + GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.num) as content , + wot.OUT_PERSON, + pu.`NAME` as userName, + LEFT(wir.TIME,10) as currentDate, + wir.TIME as currentTime + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_task_record wtr on wir.SUP_ID = wtr.ID + LEFT JOIN wf_task_record wtr2 on wtr.SUP_ID = wtr2.ID + LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID + LEFT JOIN pm_user pu on wot.OUT_PERSON = pu.ID + LEFT JOIN wf_agreement_task wat on wtr2.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla on wat.AGREEMENT_ID = wla.ID + WHERE wir.TYPE =2 and wot.IS_APPROVAL = 1 - FROM - wf_scrap_details wsd - LEFT JOIN mm_type mt on wsd.model_id = mt.ID - LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID - LEFT JOIN wf_task_record wtr on wsd.TASK_ID = wtr.ID - LEFT JOIN pm_user pu on wsd.SCRAP_PERSON = pu.ID - WHERE wsd.IS_SURE = 1 - + + AND LEFT(wir.TIME,10) BETWEEN #{startTime} and #{endTime} + + + and wla.project =#{projectId} + + GROUP BY wtr2.ID + ORDER BY LEFT(wir.TIME,10) DESC + + + + + + + - SELECT - wir.ID, - wir.INVENTORY_TYPE as taskType, - wir.INVENTORY_PERSON AS userName, - GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.INVENTORY_NUM) as content , - LEFT(wir.INVENTORY_TIME,10) as currentDate, - wir.INVENTORY_TIME as currentTime - FROM - wf_inventory_record wir - LEFT JOIN mm_type mt on wir.model_id = mt.ID - LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID - WHERE wir.INVENTORY_NUM > 0 - + wir.ID, + wir.INVENTORY_TYPE as taskType, + wir.INVENTORY_PERSON AS userName, + GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.INVENTORY_NUM) as content , + LEFT(wir.INVENTORY_TIME,10) as currentDate, + wir.INVENTORY_TIME as currentTime + FROM + wf_inventory_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + WHERE wir.INVENTORY_NUM > 0 + AND LEFT(wir.INVENTORY_TIME,10) BETWEEN #{startTime} and #{endTime} - - GROUP BY wir.ID - ORDER BY wir.INVENTORY_TIME DESC + + GROUP BY wir.ID + ORDER BY wir.INVENTORY_TIME DESC - SELECT - wnd.TASK_ID AS id, - wnd.CUSTOMER_SERVICE_REP, - GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.NUM) as content , - pu.`NAME` as userName, - LEFT(wir.TIME,10) as currentDate, - wir.TIME as currentTime - FROM - wf_info_record wir - LEFT JOIN mm_type mt on wir.model_id = mt.ID - LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID - LEFT JOIN wf_new_details wnd on wir.SUP_ID = wnd.TASK_ID - LEFT JOIN pm_user pu on wnd.CUSTOMER_SERVICE_REP = pu.ID - WHERE wir.TYPE = 5 and wnd.IS_APPROVAL = 1 - + wnd.TASK_ID AS id, + wnd.CUSTOMER_SERVICE_REP, + GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.NUM) as content , + pu.`NAME` as userName, + LEFT(wir.TIME,10) as currentDate, + wir.TIME as currentTime + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_new_details wnd on wir.SUP_ID = wnd.TASK_ID + LEFT JOIN pm_user pu on wnd.CUSTOMER_SERVICE_REP = pu.ID + WHERE wir.TYPE = 5 and wnd.IS_APPROVAL = 1 + AND LEFT(wir.TIME,10) BETWEEN #{startTime} and #{endTime} - - GROUP BY wnd.TASK_ID - ORDER BY wir.TIME DESC + + GROUP BY wnd.TASK_ID + ORDER BY wir.TIME DESC - - - - - - - - SELECT - mt2.`NAME` AS maType, - mt.`NAME` AS maName, - mt.UNIT AS maUnit, - COUNT( DISTINCT mm.ID ) AS inuseNum, - MIN( filtered_mtp.start_date ) AS outTime, - mt.IS_COUNT AS isCount, - DATEDIFF( - NOW(), - MIN( filtered_mtp.start_date )) AS days, - wla.`CODE` AS agreementCode, - bp.`NAME` AS projectName, - bc.`NAME` AS companyName - FROM - ( - SELECT - ps.machine, - ps.agreement_id, - ps.start_date - FROM - ma_type_project_storage ps - INNER JOIN mm_machines mm ON ps.machine = mm.ID - WHERE - ps.`status` = 1 - AND ps.`end_date` is null - AND mm.BATCH_STATUS = 6 - AND DATEDIFF( NOW(), ps.start_date ) > 180 - ) AS filtered_mtp - INNER JOIN mm_machines mm ON filtered_mtp.machine = mm.ID - INNER JOIN mm_type mt ON mm.TYPE = mt.ID - LEFT JOIN mm_type mt2 ON mt.PARENT_ID = mt2.ID - LEFT JOIN wf_lease_agreement wla ON filtered_mtp.agreement_id = wla.ID - LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID - LEFT JOIN bm_company bc ON bp.COMPANY_ID = bc.ID - where 1=1 - - and mt2.`NAME` like concat('%', #{maType}, '%') - - - and mt.`NAME` like concat('%', #{maName}, '%') - - GROUP BY - mt.ID, - mt2.ID, - wla.ID, - bp.ID, - bc.ID + wps.TASK_ID as id , + IFNULL(wtr.NUMBER,"退料退回") as taskCode, + pu.`NAME` as userName, + GROUP_CONCAT(mt2.`NAME`,"-",mt.`NAME`,":",wir.NUM) as content , + LEFT(wir.TIME,10) as currentDate, + wir.TIME as currentTime + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_task_record wtr on wir.SUP_ID = wtr.ID + LEFT JOIN wf_put_storage_details wps on wir.SUP_ID = wps.TASK_ID + LEFT JOIN pm_user pu on wps.CUSTOMER_SERVICE_REP = pu.ID + WHERE wir.TYPE = 3 and wps.IS_SURE = 1 + + AND LEFT(wir.TIME,10) BETWEEN #{startTime} and #{endTime} + + GROUP BY wps.TASK_ID + ORDER BY wir.TIME DESC + + + + + + + + - + SELECT + typeId, + SUM(rs.storageNum) AS storageNum, + SUM(rs.repairNum) AS repairNum, + SUM(rs.inuseNum) AS inuseNum, + SUM(rs.storageNum) + SUM(rs.repairNum) + SUM(rs.inuseNum) as total + FROM + ( - SELECT + SELECT mat1.ID AS typeId, mat1.NUM storageNum, 0 inuseNum, @@ -752,21 +752,21 @@ 0 projectNum, 0 inuseCount, 0 backCount, - 0 as pyNum, + 0 as pyNum, 0 as pkNum, mat1.IS_COUNT AS isCount FROM mm_type mat1 - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID WHERE mat1.`LEVEL` = 4 and mat1.ID= #{typeId} - AND mat1.IS_ACTIVE = '1' + AND mat1.IS_ACTIVE = '1' GROUP BY mat1.ID - UNION + UNION - SELECT + SELECT typeId, 0 storageNum, sum( leaseNum ) - SUM( backNum ) inuseNum, @@ -780,138 +780,138 @@ isCount AS isCount FROM ( - SELECT - mmt1.`NAME` AS pMachineName, - mmt.`NAME` AS machineName, - mt.`NAME` AS machineModel, - mt.ID AS typeId, - mt.BUY_PRICE AS buyPrice, - mt.UNIT, - SUM( wir.NUM ) AS leaseNum, - 0 AS backNum, - mt.IS_COUNT AS isCount - FROM - wf_info_record wir - LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID - LEFT JOIN wf_task_record wtr2 ON wtr.SUP_ID = wtr2.ID - LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID - LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID - LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID - LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID - AND wcd.MODEL_ID = wir.MODEL_ID - WHERE - wir.TYPE = 2 - AND wtr2.IS_ACTIVE = 1 - AND wcd.IS_APPROVAL = 1 - and mt.ID= #{typeId} - GROUP BY - mt.ID UNION - SELECT - mmt1.`NAME` AS pMachineName, - mmt.`NAME` AS machineName, - mt.`NAME` AS machineModel, - mt.ID AS typeId, - mt.BUY_PRICE AS buyPrice, - mt.UNIT, - 0 AS leaseNum, - SUM( wir.NUM ) AS backNum, - mt.IS_COUNT AS isCount - FROM - wf_info_record wir - LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID - LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID - LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID - LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID - LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID - WHERE - wir.TYPE = 4 and mt.ID= #{typeId} - AND wtr.IS_ACTIVE = 1 - GROUP BY - mt.ID + SELECT + mmt1.`NAME` AS pMachineName, + mmt.`NAME` AS machineName, + mt.`NAME` AS machineModel, + mt.ID AS typeId, + mt.BUY_PRICE AS buyPrice, + mt.UNIT, + SUM( wir.NUM ) AS leaseNum, + 0 AS backNum, + mt.IS_COUNT AS isCount + FROM + wf_info_record wir + LEFT JOIN wf_task_record wtr ON wir.SUP_ID = wtr.ID + LEFT JOIN wf_task_record wtr2 ON wtr.SUP_ID = wtr2.ID + LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID + LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID + LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID + LEFT JOIN wf_collar_details wcd ON wcd.TASK_ID = wtr.SUP_ID + AND wcd.MODEL_ID = wir.MODEL_ID + WHERE + wir.TYPE = 2 + AND wtr2.IS_ACTIVE = 1 + AND wcd.IS_APPROVAL = 1 + and mt.ID= #{typeId} + GROUP BY + mt.ID UNION + SELECT + mmt1.`NAME` AS pMachineName, + mmt.`NAME` AS machineName, + mt.`NAME` AS machineModel, + mt.ID AS typeId, + mt.BUY_PRICE AS buyPrice, + mt.UNIT, + 0 AS leaseNum, + SUM( wir.NUM ) AS backNum, + mt.IS_COUNT AS isCount + FROM + wf_info_record wir + LEFT JOIN wf_return_material_details wrd ON wir.SUP_ID = wrd.ID + LEFT JOIN wf_task_record wtr ON wrd.TASK_ID = wtr.ID + LEFT JOIN mm_type mt ON wir.MODEL_ID = mt.ID + LEFT JOIN mm_type mmt ON mt.PARENT_ID = mmt.ID + LEFT JOIN mm_type mmt1 ON mmt.PARENT_ID = mmt1.ID + WHERE + wir.TYPE = 4 and mt.ID= #{typeId} + AND wtr.IS_ACTIVE = 1 + GROUP BY + mt.ID ) a GROUP BY typeId - UNION + UNION SELECT - typeId, + typeId, 0 storageNum, 0 inuseNum, SUM(repairNum) + SUM(checkNum) + SUM(waitInputNum) as repairNum, 0 scrapNum, 0 projectNum, 0 inuseCount, - 0 backCount, + 0 backCount, 0 as pyNum, 0 as pkNum, - isCount + isCount FROM - ( + ( - SELECT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - SUM( wrd.REPAIR_NUM ) - SUM( wrd.ALREPAIR_NUM ) - SUM( SCRAP_NUM ) AS repairNum, - 0 checkNum, - 0 scrapNum, - 0 loseNum, - 0 waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_repair_details wrd - LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - where mat1.ID= #{typeId} - GROUP BY - wrd.MODEL_ID - UNION - SELECT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - 0 repairNum, - SUM( wrc.CHECK_NUM ) - SUM( wrc.ALCHECK_NUM ) AS checkNum, - 0 scrapNum, - 0 loseNum, - 0 waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_repair_check wrc - LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + SELECT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + SUM( wrd.REPAIR_NUM ) - SUM( wrd.ALREPAIR_NUM ) - SUM( SCRAP_NUM ) AS repairNum, + 0 checkNum, + 0 scrapNum, + 0 loseNum, + 0 waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_repair_details wrd + LEFT JOIN mm_type mat1 ON wrd.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID where mat1.ID= #{typeId} - GROUP BY - wrc.MODEL_ID + GROUP BY + wrd.MODEL_ID UNION - SELECT DISTINCT - mat1.ID AS typeId, - 0 storageNum, - 0 leaseNum, - 0 repairNum, - 0 checkNum, - 0 AS scrapNum, - 0 loseNum, - SUM( - IFNULL( PRE_PUT_NUM, 0 )) - sum( - IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum, - mat1.IS_COUNT AS isCount - FROM - wf_put_storage_details wpd - LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID - LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID - LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID - WHERE - wpd.IS_SURE = 0 and mat1.ID= #{typeId} - GROUP BY - wpd.MODEL_ID + SELECT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + 0 repairNum, + SUM( wrc.CHECK_NUM ) - SUM( wrc.ALCHECK_NUM ) AS checkNum, + 0 scrapNum, + 0 loseNum, + 0 waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_repair_check wrc + LEFT JOIN mm_type mat1 ON wrc.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + where mat1.ID= #{typeId} + GROUP BY + wrc.MODEL_ID + UNION + SELECT DISTINCT + mat1.ID AS typeId, + 0 storageNum, + 0 leaseNum, + 0 repairNum, + 0 checkNum, + 0 AS scrapNum, + 0 loseNum, + SUM( + IFNULL( PRE_PUT_NUM, 0 )) - sum( + IFNULL( AL_PUT_NUM, 0 )) AS waitInputNum, + mat1.IS_COUNT AS isCount + FROM + wf_put_storage_details wpd + LEFT JOIN mm_type mat1 ON wpd.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID + WHERE + wpd.IS_SURE = 0 and mat1.ID= #{typeId} + GROUP BY + wpd.MODEL_ID ) res - GROUP BY typeId + GROUP BY typeId ) rs - GROUP BY typeId + GROUP BY typeId - + SELECT + id as projectId, + typeId, + maType, + maName, + maUnit, + isCount, + projectName, + companyName, + SUM( leaseNum ) AS useCount, + SUM( backNum ) AS returnCount, + SUM( leaseNum ) - SUM( backNum ) diffCount , + firstTime, + lastTime, + max(backTime) as backTime + FROM + ( + SELECT + wla.PROJECT as id, + wir.model_id as typeId, + mat2.`NAME` as maType, + mat1.`NAME` as maName, + mat1.UNIT as maUnit, + mat1.is_count as isCount, + bp.`NAME` AS projectName, + bc.`NAME` as companyName, + wla.`CODE` AS agreementCode, + SUM( wir.NUM ) AS leaseNum, + "0" AS backNum, + wla.ID AS agreementId , + min(wir.time) as firstTime, + max(wir.time) as lastTime, + wir.time as backTime + FROM + wf_task_record wtr + LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID + LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID + LEFT JOIN bm_company bc on bp.COMPANY_ID = bc.ID + LEFT JOIN wf_task_record wte ON wtr.ID = wte.SUP_ID + LEFT JOIN wf_info_record wir ON wte.ID = wir.SUP_ID + LEFT JOIN mm_type mat1 ON wir.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + WHERE + wir.TYPE = 2 + AND wtr.IS_ACTIVE = 1 + + and wla.PROJECT = #{projectId} + GROUP BY - a.typeId - order by diffCount desc + wla.ID,wir.model_id + UNION + SELECT + wla.PROJECT as id, + wir.model_id as typeId, + mat2.`NAME` as maType, + mat1.`NAME` as maName, + mat1.UNIT as maUnit, + mat1.is_count as isCount, + bp.`NAME` AS projectName, + bc.`NAME` as companyName, + wla.`CODE` AS agreementCode, + "0" AS leaseNum, + SUM( wir.NUM ) AS backNum, + wla.ID AS agreementId , + "" as firstTime, + "" as lastTime, + max(wir.time) as backTime + FROM + wf_task_record wtr + LEFT JOIN wf_agreement_task wat ON wtr.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla ON wat.AGREEMENT_ID = wla.ID + LEFT JOIN bm_project bp ON wla.PROJECT = bp.ID + LEFT JOIN bm_company bc on bp.COMPANY_ID = bc.ID + LEFT JOIN wf_return_material_details wrd ON wtr.ID = wrd.TASK_ID + LEFT JOIN wf_info_record wir ON wrd.ID = wir.SUP_ID + LEFT JOIN mm_type mat1 ON wir.MODEL_ID = mat1.ID + LEFT JOIN mm_type mat2 ON mat2.ID = mat1.PARENT_ID + WHERE + wir.TYPE = 4 + AND wtr.IS_ACTIVE = 1 + + and wla.PROJECT = #{projectId} + + + GROUP BY + wla.ID ,wir.model_id + ) a + + where + maName like concat('%', #{keyword}, '%') or + maType like concat('%', #{keyword}, '%') + + GROUP BY + a.typeId + order by diffCount desc - + SELECT + bc.ID as companyId, + bc.`NAME` as companyName FROM - bm_company bc + bm_company bc WHERE bc.IS_ACTIVE =1 - + SELECT + bs.ID as companyId, + bs.`NAME` as companyName FROM - bm_unit bs + bm_unit bs WHERE bs.IS_ACTIVE =1 - SELECT wtr.DEFINITION_ID, @@ -1254,114 +1254,129 @@ wtr.OPERATION_TIME as time, "/backstage/out/isApproval" as linkUrl - FROM + FROM wf_collar_details wcd - LEFT JOIN wf_task_record wtr on wcd.TASK_ID = wtr.ID - LEFT JOIN pm_user pu on wtr.OPERATION_USER = pu.ID - LEFT JOIN wf_task_definition wd on wtr.DEFINITION_ID = wd.ID - WHERE wcd.IS_APPROVAL = 0 and wcd.IS_EXAMINE =1 + LEFT JOIN wf_task_record wtr on wcd.TASK_ID = wtr.ID + LEFT JOIN pm_user pu on wtr.OPERATION_USER = pu.ID + LEFT JOIN wf_task_definition wd on wtr.DEFINITION_ID = wd.ID + WHERE wcd.IS_APPROVAL = 0 and wcd.IS_EXAMINE =1 GROUP BY wtr.ID - SELECT - wtr.DEFINITION_ID, - wd.`NAME` as taskType, - wtr.NUMBER as taskCode, - pu.`NAME` as userName, - wtr.OPERATION_TIME as time, - "/backstage/audit/list" as linkUrl - FROM - wf_return_material_details rm + wtr.DEFINITION_ID, + wd.`NAME` as taskType, + wtr.NUMBER as taskCode, + pu.`NAME` as userName, + wtr.OPERATION_TIME as time, + "/backstage/audit/list" as linkUrl + FROM + wf_return_material_details rm LEFT JOIN wf_task_record wtr ON rm.TASK_ID = wtr.ID LEFT JOIN wf_task_definition wd ON wtr.DEFINITION_ID = wd.ID LEFT JOIN pm_user pu ON wtr.OPERATION_USER = pu.ID - WHERE - rm.IS_APPROVAL = 0 - GROUP BY - wtr.ID + WHERE + rm.IS_APPROVAL = 0 + GROUP BY + wtr.ID - - SELECT - wtr.DEFINITION_ID, - wd.`NAME` as taskType, - wtr.NUMBER as taskCode, - pu.`NAME` as userName, - wtr.OPERATION_TIME as time, - "/backstage/new/isApproval" as linkUrl - FROM - wf_new_details wnd + SELECT + wtr.DEFINITION_ID, + concat(wd.`NAME`,'-批准') as taskType, + wtr.NUMBER as taskCode, + pu.`NAME` as userName, + wtr.OPERATION_TIME as time, + "/backstage/new/isApproval" as linkUrl + FROM + wf_new_details wnd LEFT JOIN wf_task_record wtr ON wnd.TASK_ID = wtr.ID LEFT JOIN wf_task_definition wd ON wtr.DEFINITION_ID = wd.ID LEFT JOIN pm_user pu ON wtr.OPERATION_USER = pu.ID - WHERE wnd.IS_APPROVAL = 0 - GROUP BY wtr.ID + WHERE wnd.IS_APPROVAL = 0 AND wnd.IS_EXAMINE=1 + GROUP BY wtr.ID + UNION all + SELECT + wtr.DEFINITION_ID, + concat(wd.`NAME`,'-审核') as taskType, + wtr.NUMBER as taskCode, + pu.`NAME` as userName, + wtr.OPERATION_TIME as time, + "/backstage/new/isExamine" as linkUrl + FROM + wf_new_details wnd + LEFT JOIN wf_task_record wtr ON wnd.TASK_ID = wtr.ID + LEFT JOIN wf_task_definition wd ON wtr.DEFINITION_ID = wd.ID + LEFT JOIN pm_user pu ON wtr.OPERATION_USER = pu.ID + WHERE wnd.IS_EXAMINE = 0 + GROUP BY wtr.ID - + SELECT + wtr2.ID, + wtr2.NUMBER AS taskCode, + mt2.`NAME` as maType, + mt.`NAME` as maName, + wir.num, + wir.`CODE` as maCode, + wot.OUT_PERSON, + pu.`NAME` as userName, + wir.TIME as currentTime, + bp.`NAME` as projectName, + bc.`NAME` as companyName + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_task_record wtr on wir.SUP_ID = wtr.ID + LEFT JOIN wf_task_record wtr2 on wtr.SUP_ID = wtr2.ID + LEFT JOIN wf_ma_outstock wot on wir.SUP_ID = wot.TASK_ID + LEFT JOIN pm_user pu on wot.OUT_PERSON = pu.ID + LEFT JOIN wf_agreement_task wat on wtr2.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla on wat.AGREEMENT_ID = wla.ID + LEFT JOIN bm_project bp on wla.PROJECT = bp.ID + LEFT JOIN bm_company bc on bp.COMPANY_ID = bc.ID + WHERE wir.TYPE =2 and wot.IS_APPROVAL = 1 - AND LEFT(wir.TIME,10) = #{currentTime} - - AND bp.id = #{proId} - + AND LEFT(wir.TIME,10) = #{currentTime} + + AND bp.id = #{proId} + - GROUP BY wtr2.ID ,wir.model_id,wir.ma_id + GROUP BY wtr2.ID ,wir.model_id,wir.ma_id - + SELECT + wtr.ID, + wtr.NUMBER AS taskCode, + mt2.`NAME` as maType, + mt.`NAME` as maName, + wir.num, + wir.`CODE` as maCode, + wrd.OPERATOR as userName, + wir.TIME as currentTime, + bp.`NAME` as projectName, + bc.`NAME` as companyName + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_return_material_details wrd on wir.SUP_ID = wrd.ID + LEFT JOIN wf_task_record wtr on wrd.TASK_ID = wtr.ID + LEFT JOIN wf_agreement_task wat on wtr.ID = wat.TASK_ID + LEFT JOIN wf_lease_agreement wla on wat.AGREEMENT_ID = wla.ID + LEFT JOIN bm_project bp on wla.PROJECT = bp.ID + LEFT JOIN bm_company bc on bp.COMPANY_ID = bc.ID + WHERE wir.TYPE =4 and LEFT(wir.TIME,10) = #{currentTime} AND bp.id = #{proId} @@ -1371,8 +1386,8 @@ - + SELECT wir.ID, mt2.`NAME` as maType, mt.`NAME` as maName, @@ -1384,116 +1399,116 @@ wir.REPAIR_PERSON_NAME as userName, rf.file_url as fileUrl, wir.REMARK - FROM + FROM wf_info_record wir - LEFT JOIN mm_type mt on wir.MODEL_ID = mt.ID - LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID - LEFT JOIN mm_machines mm on mm.DEVICE_CODE = wir.`CODE` - LEFT JOIN repair_file rf on wir.id = rf.info_id + LEFT JOIN mm_type mt on wir.MODEL_ID = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN mm_machines mm on mm.DEVICE_CODE = wir.`CODE` + LEFT JOIN repair_file rf on wir.id = rf.info_id - WHERE wir.TYPE = 6 - and left(wir.TIME,10) =#{currentTime} + WHERE wir.TYPE = 6 + and left(wir.TIME,10) =#{currentTime} - + SELECT + wir.ID, + mtt.`NAME` AS maType, + mt.`NAME` AS maName, + mam.DEVICE_CODE AS maCode, + wir.TIME AS currentTime, + ROUND(wir.NUM) as num, + wir.SCRAP_URL as fileUrl, + pu.`NAME` as userName, + wir.SCRAP_REASON AS remark + FROM wf_info_record wir + LEFT JOIN wf_task_record sup1 ON sup1.ID = wir.SUP_ID + LEFT JOIN wf_task_record sup2 ON sup2.ID = sup1.SUP_ID + LEFT JOIN mm_type mt ON mt.ID = wir.MODEL_ID + LEFT JOIN mm_type mtt ON mtt.ID = mt.PARENT_ID + LEFT JOIN mm_machines mam ON wir.`CODE` = mam.DEVICE_CODE and wir.MODEL_ID = mam.TYPE + LEFT JOIN pm_user pu on sup2.OPERATION_USER = pu.ID + WHERE left(wir.TIME,10) =#{currentTime} and wir.RM_STATUS = 14 - + SELECT + wtr.ID, + wtr.NUMBER AS taskCode, + mt2.`NAME` as maType, + mt.`NAME` as maName, + wir.num, + IFNULL(wir.`CODE`,"-") as maCode, + pu.`NAME` as userName, + wir.TIME as currentTime + FROM + wf_info_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + LEFT JOIN wf_put_storage_details wpd on wir.SUP_ID = wpd.TASK_ID + LEFT JOIN wf_task_record wtr on wpd.TASK_ID = wtr.ID + LEFT JOIN pm_user pu on wpd.CUSTOMER_SERVICE_REP = pu.ID + WHERE wir.TYPE =3 + and LEFT(wir.TIME,10) = #{currentTime} + GROUP BY wtr.ID ,wir.model_id,wir.`CODE` - SELECT mt2.`NAME` as maType, mt.`NAME` as maName, wir.num, - wnd.ACTUAL_PRICE as price, + wnd.ACTUAL_PRICE as price, wnd.CHECK_URL as fileUrl, - pu.`NAME` as userName, + pu.`NAME` as userName, wir.TIME as currentTime, wfa.LAUNCH_TIME as startTime, wfa.FINISH_TIME as endTime , mv.`NAME` as remark - FROM + FROM wf_info_record wir - LEFT JOIN mm_type mt on wir.model_id = mt.ID - LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID - LEFT JOIN wf_new_details wnd on wir.SUP_ID = wnd.TASK_ID - LEFT JOIN wf_task_appoint wfa on wnd.TASK_ID = wfa.TASK_ID - LEFT JOIN mm_vender mv on wnd.MA_VENDER = mv.ID - LEFT JOIN pm_user pu on wnd.CUSTOMER_SERVICE_REP = pu.ID - WHERE wir.TYPE =5 - and LEFT(wir.TIME,10) = #{currentTime} - - - - - - + + + SELECT + wir.ID, + mt2.`NAME` as maType, + mt.`NAME` as maName, + GROUP_CONCAT(wir.INVENTORY_TYPE,":",wir.INVENTORY_NUM) AS num , + wir.INVENTORY_PERSON AS userName, + wir.INVENTORY_TIME as currentTime, + wir.REMARK as remark + FROM + wf_inventory_record wir + LEFT JOIN mm_type mt on wir.model_id = mt.ID + LEFT JOIN mm_type mt2 on mt.PARENT_ID = mt2.ID + WHERE wir.INVENTORY_NUM > 0 + + AND LEFT(wir.INVENTORY_TIME,10) = #{currentTime} + GROUP BY wir.ID + + + + diff --git a/resources/mybatis/newInput/NewInputMapper.xml b/resources/mybatis/newInput/NewInputMapper.xml index 9160517..5fcbd55 100644 --- a/resources/mybatis/newInput/NewInputMapper.xml +++ b/resources/mybatis/newInput/NewInputMapper.xml @@ -105,7 +105,35 @@ AND wnd.IS_ACTIVE = '1' - +