Commit 5a2ab32b by liuyang

2024-09-06 app生产任务查询修改

parent f3aebddc
...@@ -202,20 +202,21 @@ ...@@ -202,20 +202,21 @@
</sql> </sql>
<sql id="appCustomCondition"> <sql id="appCustomCondition">
<include refid="HGXSDataAuth.authConditionA"/>
<isNotEmpty prepend=" AND " property="companyCodes"> <isNotEmpty prepend=" AND " property="companyCodes">
h.COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate> a.COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCodes"> <isNotEmpty prepend=" AND " property="factoryCodes">
h.FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate> a.FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryNames"> <isNotEmpty prepend=" AND " property="factoryNames">
h.FACTORY_NAME IN <iterate close=")" open="(" conjunction="," property="factoryNames">#factoryNames[]#</iterate> a.FACTORY_NAME IN <iterate close=")" open="(" conjunction="," property="factoryNames">#factoryNames[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCodes"> <isNotEmpty prepend=" AND " property="groupCodes">
h.GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate> a.GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="groupNames"> <isNotEmpty prepend=" AND " property="groupNames">
h.GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate> a.GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty> </isNotEmpty>
</sql> </sql>
...@@ -285,56 +286,56 @@ ...@@ -285,56 +286,56 @@
<select id="queryApp" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007"> <select id="queryApp" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT SELECT
h.id as "id", a.id as "id",
h.mat_id as "matId", <!-- 物料清单ID --> a.mat_id as "matId", <!-- 物料清单ID -->
h.order_id as "orderId", <!-- 生产计划ID --> a.order_id as "orderId", <!-- 生产计划ID -->
h.order_detail_id as "orderDetailId", <!-- 生产计划明细ID --> a.order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
h.tech_flow_id as "techFlowId", <!-- 工艺流程ID --> a.tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
h.tech_flow_name as "techFlowName", <!-- 工艺流程名称 --> a.tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
h.invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id --> a.invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
h.process_code as "processCode", <!-- 工序编码 --> a.process_code as "processCode", <!-- 工序编码 -->
h.process_name as "processName", <!-- 工序名称 --> a.process_name as "processName", <!-- 工序名称 -->
h.process_order as "processOrder", <!-- 加工顺序 --> a.process_order as "processOrder", <!-- 加工顺序 -->
h.company_code as "companyCode", <!-- 公司编码 --> a.company_code as "companyCode", <!-- 公司编码 -->
h.company_name as "companyName", <!-- 公司名称 --> a.company_name as "companyName", <!-- 公司名称 -->
h.dep_code as "depCode", <!-- 部门编码 --> a.dep_code as "depCode", <!-- 部门编码 -->
h.dep_name as "depName", <!-- 部门名称 --> a.dep_name as "depName", <!-- 部门名称 -->
h.proj_code as "projCode", <!-- 项目编码 --> a.proj_code as "projCode", <!-- 项目编码 -->
h.proj_name as "projName", <!-- 项目名称 --> a.proj_name as "projName", <!-- 项目名称 -->
h.task_code as "taskCode", <!-- 任务编码 --> a.task_code as "taskCode", <!-- 任务编码 -->
h.product_type as "productType", <!-- 产品类型 --> a.product_type as "productType", <!-- 产品类型 -->
h.product_code as "productCode", <!-- 产品编号 --> a.product_code as "productCode", <!-- 产品编号 -->
h.product_name as "productName", <!-- 产品名称 --> a.product_name as "productName", <!-- 产品名称 -->
h.plan_start_date as "planStartDate", <!-- 计划开始日期 --> a.plan_start_date as "planStartDate", <!-- 计划开始日期 -->
h.plan_end_date as "planEndDate", <!-- 计划结束日期 --> a.plan_end_date as "planEndDate", <!-- 计划结束日期 -->
h.factory_code as "factoryCode", <!-- 工厂编号 --> a.factory_code as "factoryCode", <!-- 工厂编号 -->
h.factory_name as "factoryName", <!-- 工厂名称 --> a.factory_name as "factoryName", <!-- 工厂名称 -->
h.group_code as "groupCode", <!-- 工作组编号 --> a.group_code as "groupCode", <!-- 工作组编号 -->
h.group_name as "groupName", <!-- 工作组名称 --> a.group_name as "groupName", <!-- 工作组名称 -->
h.complete_date as "completeDate", <!-- 完工日期 --> a.complete_date as "completeDate", <!-- 完工日期 -->
h.quantity as "quantity", <!-- 数量 --> a.quantity as "quantity", <!-- 数量 -->
h.finish_quantity as "finishQuantity", <!-- 完工数量 --> a.finish_quantity as "finishQuantity", <!-- 完工数量 -->
h.unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 --> a.unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
h.single_weight as "singleWeight", <!-- 单重 --> a.single_weight as "singleWeight", <!-- 单重 -->
h.total_weight as "totalWeight", <!-- 总重 --> a.total_weight as "totalWeight", <!-- 总重 -->
h.finish_weight as "finishWeight", <!-- 完工重量 --> a.finish_weight as "finishWeight", <!-- 完工重量 -->
h.unfinish_weight as "unfinishWeight", <!-- 未完工重量 --> a.unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
h.account_code as "accountCode", <!-- 帐套 --> a.account_code as "accountCode", <!-- 帐套 -->
h.created_by as "createdBy", <!-- 创建人 --> a.created_by as "createdBy", <!-- 创建人 -->
h.created_name as "createdName", <!-- 创建人名称 --> a.created_name as "createdName", <!-- 创建人名称 -->
h.created_time as "createdTime", <!-- 创建时间 --> a.created_time as "createdTime", <!-- 创建时间 -->
h.updated_by as "updatedBy", <!-- 更新人 --> a.updated_by as "updatedBy", <!-- 更新人 -->
h.updated_name as "updatedName", <!-- 修改人名称 --> a.updated_name as "updatedName", <!-- 修改人名称 -->
h.updated_time as "updatedTime", <!-- 更新时间 --> a.updated_time as "updatedTime", <!-- 更新时间 -->
h.LENGTH as "length", <!-- 长 --> a.LENGTH as "length", <!-- 长 -->
h.SPEC as "spec", <!-- 规格 --> a.SPEC as "spec", <!-- 规格 -->
ifnull(h2.quantity,0) as "taskQuantity", <!-- 任务数量 --> ifnull(h2.quantity,0) as "taskQuantity", <!-- 任务数量 -->
h.quantity - ifnull(h2.quantity,0) as "unTaskQuantity", <!-- 待任务数量 --> a.quantity - ifnull(h2.quantity,0) as "unTaskQuantity", <!-- 待任务数量 -->
case when h.quantity - ifnull(h2.quantity,0) &lt;= 0 then 2 case when a.quantity - ifnull(h2.quantity,0) &lt;= 0 then 2
when ifnull(h2.quantity,0) &gt;0 and h.quantity - ifnull(h2.quantity,0) &gt; 0 then 1 when ifnull(h2.quantity,0) &gt;0 and a.quantity - ifnull(h2.quantity,0) &gt; 0 then 1
else 0 else 0
end as "isComplete" end as "isComplete"
FROM ${hggpSchema}.HGSC007 h FROM ${hggpSchema}.HGSC007 a
LEFT JOIN ( LEFT JOIN (
select task_id,sum(quantity) as quantity select task_id,sum(quantity) as quantity
from ${hggpSchema}.HGSC008 from ${hggpSchema}.HGSC008
...@@ -376,151 +377,132 @@ ...@@ -376,151 +377,132 @@
work_code like ('%$workCode$%') work_code like ('%$workCode$%')
</isNotEmpty> </isNotEmpty>
group by task_id group by task_id
) h2 ON h.id = h2.task_id ) h2 ON a.id = h2.task_id
WHERE 1=1 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
h.id = #id# a.id = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="matId"> <isNotEmpty prepend=" AND " property="matId">
h.mat_id = #matId# a.mat_id = #matId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId"> <isNotEmpty prepend=" AND " property="orderId">
h.order_id = #orderId# a.order_id = #orderId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId"> <isNotEmpty prepend=" AND " property="orderDetailId">
h.order_detail_id = #orderDetailId# a.order_detail_id = #orderDetailId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId"> <isNotEmpty prepend=" AND " property="techFlowId">
h.tech_flow_id = #techFlowId# a.tech_flow_id = #techFlowId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName"> <isNotEmpty prepend=" AND " property="techFlowName">
h.tech_flow_name = #techFlowName# a.tech_flow_name = #techFlowName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId"> <isNotEmpty prepend=" AND " property="inventProcessId">
h.invent_process_id = #inventProcessId# a.invent_process_id = #inventProcessId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode"> <isNotEmpty prepend=" AND " property="processCode">
h.process_code = #processCode# a.process_code = #processCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="processName"> <isNotEmpty prepend=" AND " property="processName">
h.process_name = #processName# a.process_name = #processName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder"> <isNotEmpty prepend=" AND " property="processOrder">
h.process_order = #processOrder# a.process_order = #processOrder#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
h.company_code = #companyCode# a.company_code = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
h.company_name = #companyName# a.company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
h.dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
h.dep_name = #depName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode"> <isNotEmpty prepend=" AND " property="projCode">
h.proj_code = #projCode# a.proj_code = #projCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
h.proj_name LIKE CONCAT('%', #projName#, '%') a.proj_name LIKE CONCAT('%', #projName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode"> <isNotEmpty prepend=" AND " property="taskCode">
h.task_code = #taskCode# a.task_code = #taskCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="productType"> <isNotEmpty prepend=" AND " property="productType">
h.product_type = #productType# a.product_type = #productType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode"> <isNotEmpty prepend=" AND " property="productCode">
h.product_code LIKE CONCAT('%', #productCode#, '%') a.product_code LIKE CONCAT('%', #productCode#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="productName"> <isNotEmpty prepend=" AND " property="productName">
h.product_name LIKE CONCAT('%', #productName#, '%') a.product_name LIKE CONCAT('%', #productName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate"> <isNotEmpty prepend=" AND " property="planStartDate">
h.plan_start_date = #planStartDate# a.plan_start_date = #planStartDate#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate"> <isNotEmpty prepend=" AND " property="planEndDate">
h.plan_end_date = #planEndDate# a.plan_end_date = #planEndDate#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode"> <isNotEmpty prepend=" AND " property="factoryCode">
h.factory_code = #factoryCode# a.factory_code = #factoryCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName"> <isNotEmpty prepend=" AND " property="factoryName">
h.factory_name = #factoryName# a.factory_name = #factoryName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode"> <isNotEmpty prepend=" AND " property="groupCode">
h.group_code = #groupCode# a.group_code = #groupCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName"> <isNotEmpty prepend=" AND " property="groupName">
h.group_name LIKE CONCAT('%', #groupName# ,'%') a.group_name LIKE CONCAT('%', #groupName# ,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="completeDate"> <isNotEmpty prepend=" AND " property="completeDate">
h.complete_date = #completeDate# a.complete_date = #completeDate#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity"> <isNotEmpty prepend=" AND " property="quantity">
h.quantity = #quantity# a.quantity = #quantity#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="finishQuantity"> <isNotEmpty prepend=" AND " property="finishQuantity">
h.finish_quantity = #finishQuantity# a.finish_quantity = #finishQuantity#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishQuantity"> <isNotEmpty prepend=" AND " property="unfinishQuantity">
h.unfinish_quantity = #unfinishQuantity# a.unfinish_quantity = #unfinishQuantity#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight"> <isNotEmpty prepend=" AND " property="singleWeight">
h.single_weight = #singleWeight# a.single_weight = #singleWeight#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight"> <isNotEmpty prepend=" AND " property="totalWeight">
h.total_weight = #totalWeight# a.total_weight = #totalWeight#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="finishWeight"> <isNotEmpty prepend=" AND " property="finishWeight">
h.finish_weight = #finishWeight# a.finish_weight = #finishWeight#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishWeight"> <isNotEmpty prepend=" AND " property="unfinishWeight">
h.unfinish_weight = #unfinishWeight# a.unfinish_weight = #unfinishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
h.account_code = #accountCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
h.created_by = #createdBy# a.created_by = #createdBy#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName"> <isNotEmpty prepend=" AND " property="createdName">
h.created_name = #createdName# a.created_name = #createdName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime"> <isNotEmpty prepend=" AND " property="createdTime">
h.created_time LIKE CONCAT('%', #createdTime# ,'%') a.created_time LIKE CONCAT('%', #createdTime# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
h.updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
h.updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
h.updated_time = #updatedTime#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="ids"> <isNotEmpty prepend=" AND " property="ids">
h.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> a.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isEqual prepend=" AND " property="isComplete" compareValue="0"> <isEqual prepend=" AND " property="isComplete" compareValue="0">
ifnull(h2.quantity,0) = 0 AND h.quantity - ifnull(h2.quantity,0) = h.quantity ifnull(h2.quantity,0) = 0 AND a.quantity - ifnull(h2.quantity,0) = a.quantity
</isEqual> </isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="1"> <isEqual prepend=" AND " property="isComplete" compareValue="1">
ifnull(h2.quantity,0) > 0 AND h.quantity - ifnull(h2.quantity,0) &gt; 0 ifnull(h2.quantity,0) > 0 AND a.quantity - ifnull(h2.quantity,0) &gt; 0
</isEqual> </isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="2"> <isEqual prepend=" AND " property="isComplete" compareValue="2">
h.quantity &gt; 0 AND h.quantity - ifnull(h2.quantity,0) &lt;= 0 a.quantity &gt; 0 AND a.quantity - ifnull(h2.quantity,0) &lt;= 0
</isEqual> </isEqual>
<include refid="appCustomCondition"/> <include refid="appCustomCondition"/>
<include refid="appCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
h.id desc, h.product_type asc, h.product_name, h.process_order desc a.id desc, a.product_type asc, a.product_name, a.process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
......
...@@ -43,6 +43,13 @@ ...@@ -43,6 +43,13 @@
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode# A.ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
<!-- 0:不启用角色权限,1或者空:启用-->
<isNotEqual property="enableRoleAuth" compareValue="0">
<include refid="HGXSDataAuth.roleAuthConditionA"/>
</isNotEqual>
</sql>
<sql id="roleAuthConditionA">
<!-- 无权限时使用 --> <!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode"> <isNotEmpty prepend=" AND " property="authDepCode">
A.DEP_CODE = #authDepCode# A.DEP_CODE = #authDepCode#
...@@ -50,7 +57,7 @@ ...@@ -50,7 +57,7 @@
<!-- 仅本人和部门组合 --> <!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1"> <isEqual prepend=" AND " property="authCombination" compareValue="1">
(A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction="," (A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>) property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual> </isEqual>
<!-- 仅本人或部门 --> <!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1"> <isNotEqual prepend=" AND " property="authCombination" compareValue="1">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment