Commit 7da6bf3f by liuyang

2024-09-04 生产任务增加已报工、未报工字段,报完工就显示数据

parent 30f89125
......@@ -21,4 +21,10 @@ public class HgScSqlConstant {
// 修改项目名称
public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName";
}
public static class HgSc007 {
//app 查询生产任务
public static final String QUERY_APP = "HGSC007.queryApp";
}
}
......@@ -66,6 +66,9 @@ public class HGSC007 extends DaoEPBase {
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String FIELD_spec = "spec"; /* 规格*/
public static final String FIELD_length = "length"; /* 长*/
public static final String FIELD_IS_COMPLTE = "isComplete";
public static final String FIELD_TASK_QUANTITY = "taskQuantity";
public static final String FIELD_UN_TASK_QUANTITY = "unTaskQuantity";
public static final String COL_id = "id";
......@@ -165,6 +168,9 @@ public class HGSC007 extends DaoEPBase {
private String updatedTime = " "; /* 更新时间*/
private String spec = " "; /* 规格*/
private BigDecimal length = new BigDecimal("0"); /* 长*/
private Integer isComplete = new Integer(0); /* 是否完工 0-未报工 1-部分报工 2-已报工*/
private BigDecimal taskQuantity = new BigDecimal("0");
private BigDecimal unTaskQuantity = new BigDecimal("0");
/**
......@@ -361,6 +367,18 @@ public class HGSC007 extends DaoEPBase {
eiColumn.setDescName("长");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_COMPLTE);
eiColumn.setDescName("报工状态");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TASK_QUANTITY);
eiColumn.setDescName("报工数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UN_TASK_QUANTITY);
eiColumn.setDescName("待报工数量");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -1043,6 +1061,30 @@ public class HGSC007 extends DaoEPBase {
this.length = length;
}
public Integer getIsComplete() {
return isComplete;
}
public void setIsComplete(Integer isComplete) {
this.isComplete = isComplete;
}
public BigDecimal getTaskQuantity() {
return taskQuantity;
}
public void setTaskQuantity(BigDecimal taskQuantity) {
this.taskQuantity = taskQuantity;
}
public BigDecimal getUnTaskQuantity() {
return unTaskQuantity;
}
public void setUnTaskQuantity(BigDecimal unTaskQuantity) {
this.unTaskQuantity = unTaskQuantity;
}
/**
* get the value from Map.
*
......@@ -1094,6 +1136,9 @@ public class HGSC007 extends DaoEPBase {
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_time)), updatedTime));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_spec)), spec));
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_length)), length));
setIsComplete(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_COMPLTE)), isComplete));
setTaskQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TASK_QUANTITY)), taskQuantity));
setUnTaskQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UN_TASK_QUANTITY)), unTaskQuantity));
}
......@@ -1147,6 +1192,9 @@ public class HGSC007 extends DaoEPBase {
map.put(FIELD_updated_time, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_updated_time)));
map.put(FIELD_spec, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_spec)));
map.put(FIELD_length, StringUtils.toString(length, eiMetadata.getMeta(FIELD_length)));
map.put(FIELD_IS_COMPLTE, StringUtils.toString(isComplete, eiMetadata.getMeta(FIELD_IS_COMPLTE)));
map.put(FIELD_TASK_QUANTITY, StringUtils.toString(taskQuantity, eiMetadata.getMeta(FIELD_TASK_QUANTITY)));
map.put(FIELD_UN_TASK_QUANTITY, StringUtils.toString(unTaskQuantity, eiMetadata.getMeta(FIELD_UN_TASK_QUANTITY)));
return map;
}
......
......@@ -7,6 +7,7 @@ import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Company;
......@@ -271,5 +272,21 @@ public class ServiceHGSC007 extends ServiceEPBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "生产任务", operType = "APP查询", operDesc = "APP查询")
public EiInfo queryApp(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String creatTime = MapUtils.getString(queryMap, HGSC007.FIELD_created_time);
if (StringUtils.isNotBlank(creatTime)) {
queryMap.put(HGSC007.FIELD_created_time, StringUtil.removeHorizontalLine(creatTime));
}
// 仅查询自己所在组的任务 added by songx at 20240820
HgScUtils.HgSc007.setOrgCondition(queryMap);
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007.QUERY_APP, new HGSC007());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -203,6 +203,24 @@
</isNotEmpty>
</sql>
<sql id="appCustomCondition">
<isNotEmpty prepend=" AND " property="companyCodes">
h.COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCodes">
h.FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryNames">
h.FACTORY_NAME IN <iterate close=")" open="(" conjunction="," property="factoryNames">#factoryNames[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCodes">
h.GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupNames">
h.GROUP_NAME IN <iterate close=")" open="(" conjunction="," property="groupNames">#groupNames[]#</iterate>
</isNotEmpty>
</sql>
<sql id="appCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
......@@ -269,6 +287,248 @@
<include refid="customCondition"/>
</select>
<select id="queryApp" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007">
SELECT
h.id as "id",
h.mat_id as "matId", <!-- 物料清单ID -->
h.order_id as "orderId", <!-- 生产计划ID -->
h.order_detail_id as "orderDetailId", <!-- 生产计划明细ID -->
h.tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
h.tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
h.invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
h.process_code as "processCode", <!-- 工序编码 -->
h.process_name as "processName", <!-- 工序名称 -->
h.process_order as "processOrder", <!-- 加工顺序 -->
h.company_code as "companyCode", <!-- 公司编码 -->
h.company_name as "companyName", <!-- 公司名称 -->
h.dep_code as "depCode", <!-- 部门编码 -->
h.dep_name as "depName", <!-- 部门名称 -->
h.proj_code as "projCode", <!-- 项目编码 -->
h.proj_name as "projName", <!-- 项目名称 -->
h.task_code as "taskCode", <!-- 任务编码 -->
h.product_type as "productType", <!-- 产品类型 -->
h.product_code as "productCode", <!-- 产品编号 -->
h.product_name as "productName", <!-- 产品名称 -->
h.plan_start_date as "planStartDate", <!-- 计划开始日期 -->
h.plan_end_date as "planEndDate", <!-- 计划结束日期 -->
h.factory_code as "factoryCode", <!-- 工厂编号 -->
h.factory_name as "factoryName", <!-- 工厂名称 -->
h.group_code as "groupCode", <!-- 工作组编号 -->
h.group_name as "groupName", <!-- 工作组名称 -->
h.complete_date as "completeDate", <!-- 完工日期 -->
h.quantity as "quantity", <!-- 数量 -->
h.finish_quantity as "finishQuantity", <!-- 完工数量 -->
h.unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
h.single_weight as "singleWeight", <!-- 单重 -->
h.total_weight as "totalWeight", <!-- 总重 -->
h.finish_weight as "finishWeight", <!-- 完工重量 -->
h.unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
h.account_code as "accountCode", <!-- 帐套 -->
h.created_by as "createdBy", <!-- 创建人 -->
h.created_name as "createdName", <!-- 创建人名称 -->
h.created_time as "createdTime", <!-- 创建时间 -->
h.updated_by as "updatedBy", <!-- 更新人 -->
h.updated_name as "updatedName", <!-- 修改人名称 -->
h.updated_time as "updatedTime", <!-- 更新时间 -->
h.LENGTH as "length", <!-- 长 -->
h.SPEC as "spec", <!-- 规格 -->
ifnull(h2.quantity,0) as "taskQuantity", <!-- 任务数量 -->
h.quantity - ifnull(h2.quantity,0) as "unTaskQuantity", <!-- 待任务数量 -->
case when h.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
else 0
end as "isComplete"
FROM ${hggpSchema}.HGSC007 h
LEFT JOIN (
select task_id,sum(quantity) as quantity
from ${hggpSchema}.HGSC008
where 1=1
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name like ('%$companyName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name like ('%$groupName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="workCode">
work_code like ('%$workCode$%')
</isNotEmpty>
group by task_id
) h2 ON h.id = h2.task_id
WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
h.id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
h.mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
h.order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
h.order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
h.tech_flow_id = #techFlowId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowName">
h.tech_flow_name = #techFlowName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventProcessId">
h.invent_process_id = #inventProcessId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
h.process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
h.process_name = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
h.process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
h.company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
h.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 prepend=" AND " property="projCode">
h.proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
h.proj_name LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
h.task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productType">
h.product_type = #productType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
h.product_code LIKE CONCAT('%', #productCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
h.product_name LIKE CONCAT('%', #productName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planStartDate">
h.plan_start_date = #planStartDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planEndDate">
h.plan_end_date = #planEndDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
h.factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
h.factory_name = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
h.group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
h.group_name LIKE CONCAT('%', #groupName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="completeDate">
h.complete_date = #completeDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
h.quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishQuantity">
h.finish_quantity = #finishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishQuantity">
h.unfinish_quantity = #unfinishQuantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
h.single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
h.total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishWeight">
h.finish_weight = #finishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unfinishWeight">
h.unfinish_weight = #unfinishWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
h.account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
h.created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
h.created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
h.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 prepend=" AND " property="ids">
h.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isEqual prepend=" AND " property="isComplete" compareValue="0">
ifnull(h2.quantity,0) = 0 AND h.quantity - ifnull(h2.quantity,0) = h.quantity
</isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="1">
ifnull(h2.quantity,0) > 0 AND h.quantity - ifnull(h2.quantity,0) &gt; 0
</isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="2">
h.quantity &gt; 0 AND h.quantity - ifnull(h2.quantity,0) &lt;= 0
</isEqual>
<include refid="appCustomCondition"/>
<include refid="appCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
h.id desc, h.product_type asc, h.product_name, h.process_order desc
</isEmpty>
</dynamic>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007 (id,
mat_id, <!-- 物料清单ID -->
......
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