Commit c1c9904b by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents 3beb5ae2 ee2940b9
......@@ -7,9 +7,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 产品类型枚举
*
* @author:songx
* @date:2024/9/10,8:43
*/
public enum ProductTypeEnum {
STRUCT(1,"构建"),
PART(2,"零件");
STRUCT(1, "构件"),
PART(2, "零件");
private Integer code;
......@@ -36,9 +43,9 @@ public enum ProductTypeEnum {
return block;
}
public static ProductTypeEnum getEnumByCode(Integer code){
for (ProductTypeEnum en : ProductTypeEnum.values()){
if(code.compareTo(en.code)==0){
public static ProductTypeEnum getEnumByCode(Integer code) {
for (ProductTypeEnum en : ProductTypeEnum.values()) {
if (code.compareTo(en.code) == 0) {
return en;
}
}
......
......@@ -57,6 +57,20 @@ public class CommonConstant {
}
/**
* 排序类型
*
* @author:songx
* @date:2024/1/20,15:04
*/
public static class SortType {
// 正序
public static final String ASC = "asc";
// 倒序
public static final String DESC = "desc";
}
/**
* 设备计划状态
*
* @author:songx
......
......@@ -63,7 +63,7 @@ public class ServiceHGKC008A extends ServiceBase {
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_RECEIVE_ID);
//查看明细是否都删除了,都删除了得修改主表信息
HGKCTools.HgKc008A.checkMainData(ids,Long.valueOf(receiveId));
HGKCTools.HgKc008A.checkMainData(ids, Long.valueOf(receiveId));
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -74,19 +74,21 @@ public class ServiceHGKC008A extends ServiceBase {
return inInfo;
}
public EiInfo save(EiInfo inInfo){
/**
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGKC008A hgkc008a = new HGKC008A();
hgkc008a.fromMap(resultMap);
HGKC008A fKc008a = MapUtils.toDaoEPBase(inInfo, HGKC008A.class);
//查询领料单
HGKC008 hgkc008 = HGKCTools.HgKc008.getById(hgkc008a.getReceiveId());
this.checkSaveData(hgkc008a,hgkc008);
this.setData(hgkc008a,hgkc008);
if(Objects.nonNull(hgkc008a.getId())&&hgkc008a.getId()!=0){
DaoUtils.update(HGKC008A.UPDATE, hgkc008a);
}else {
DaoUtils.insert(HGKC008A.INSERT, hgkc008a);
HGKC008 dbKc008 = HGKCTools.HgKc008.getById(fKc008a.getReceiveId());
this.checkSaveData(fKc008a, dbKc008);
this.setData(fKc008a, dbKc008);
if (Objects.nonNull(fKc008a.getId()) && fKc008a.getId() != 0) {
DaoUtils.update(HGKC008A.UPDATE, fKc008a);
} else {
DaoUtils.insert(HGKC008A.INSERT, fKc008a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
......@@ -98,22 +100,23 @@ public class ServiceHGKC008A extends ServiceBase {
/**
* 给明细赋值
*
* @param hgkc008a
* @param hgkc008
*/
private void setData(HGKC008A hgkc008a, HGKC008 hgkc008) {
if(Objects.nonNull(hgkc008)){
if (Objects.nonNull(hgkc008)) {
hgkc008a.setProjCode(hgkc008.getProjCode());
hgkc008a.setProjName(hgkc008.getProjName());
hgkc008a.setWhCode(hgkc008.getWhCode());
hgkc008a.setWhName(hgkc008.getWhName());
hgkc008a.setCompanyCode(hgkc008.getCompanyCode());
hgkc008a.setCompanyName(hgkc008.getCompanyName());
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.DEFAULT) == 0){
if (hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.DEFAULT) == 0) {
//如果明细里面有负数的,主表就是退库
if(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0){
if (hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0) {
hgkc008.setReceiveType(HGConstant.ReceiveType.TK);
}else{
} else {
hgkc008.setReceiveType(HGConstant.ReceiveType.ZC);
}
DaoUtils.update(HGKC008.UPDATE_RECEIVE_TYPE, hgkc008);
......@@ -124,23 +127,22 @@ public class ServiceHGKC008A extends ServiceBase {
/**
* 校验保存的数据
*
* @param hgkc008a
* @param hgkc008
* @param fKc008a
* @param dbKc008
*/
private void checkSaveData(HGKC008A hgkc008a, HGKC008 hgkc008) {
private void checkSaveData(HGKC008A fKc008a, HGKC008 dbKc008) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isNull(hgkc008a.getReceiveId(), "未获取到生产领料单ID信息");
AssertUtils.isTrue(hgkc008a.getInvWeight().compareTo(BigDecimal.ZERO) == 0, "重量不能为0");
if(Objects.nonNull(hgkc008a.getId())&&hgkc008a.getId()!=0){
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0");
AssertUtils.isNull(fKc008a.getReceiveId(), "未获取到生产领料单ID信息");
AssertUtils.isTrue(fKc008a.getInvWeight().compareTo(BigDecimal.ZERO) == 0, "重量不能为0");
if (Objects.nonNull(fKc008a.getId()) && fKc008a.getId() != 0) {
if (dbKc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0) {
AssertUtils.isTrue(fKc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0");
}
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
if (dbKc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0) {
AssertUtils.isTrue(fKc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
}
}
}
}
......
......@@ -25,6 +25,28 @@ public class HgScSqlConstant {
/**
*
* @author:songx
* @date:2024/9/10,10:17
*/
public static class HgSc005 {
// 修改排产状态
public static final String UPDATE_IS_SCHEDULE = "HGSC005.updateIsSchedule";
}
/**
*
* @author:songx
* @date:2024/9/10,9:59
*/
public static class HgSc005A {
// 修改计划时间
public static final String UPDATE_PLAN_DATE = "HGSC005A.updatePlanDate";
}
/**
*
* @author:songx
* @date:2024/9/8,9:41
*/
public static class HgSc007 {
......
......@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
......@@ -125,15 +126,16 @@ public class ServiceHGSC005A extends ServiceBase {
* @return
*/
@OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产")
public EiInfo scheduleEx(EiInfo inInfo) {
public EiInfo scheduleAsc(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(queryMap, "A");
// 排产计算
int count = HGSCTools.THGSC005A.schedule(dbSc005, queryMap, CommonConstant.SortType.ASC);
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
DaoUtils.update(HgScSqlConstant.HgSc005.UPDATE_IS_SCHEDULE, dbSc005);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
......@@ -156,9 +158,9 @@ public class ServiceHGSC005A extends ServiceBase {
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(queryMap, "D");
int count = HGSCTools.THGSC005A.schedule(dbSc005, queryMap, CommonConstant.SortType.DESC);
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
DaoUtils.update(HgScSqlConstant.HgSc005.UPDATE_IS_SCHEDULE, dbSc005);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-16 16:50:12
Version : 1.0
schema : hggp
tableName : HGSC005
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
commit_status TINYINT,
finish_date VARCHAR,
account_code VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC005">
<sql id="column">
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
commit_status as "commitStatus", <!-- 提交状态 0:未提交;2:已提交 -->
is_schedule as "isSchedule", <!-- 是否排产 0:否;1:是 -->
finish_date as "finishDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
......@@ -86,34 +84,12 @@
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matIds">
mat_id NOT IN <iterate close=")" open="(" conjunction="," property="matIds">#matIds[]#</iterate>
mat_id NOT IN
<iterate close=")" open="(" conjunction="," property="matIds">#matIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC005">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
commit_status as "commitStatus", <!-- 提交状态 0:未提交;2:已提交 -->
is_schedule as "isSchedule", <!-- 是否排产 0:否;1:是 -->
finish_date as "finishDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005 WHERE 1=1
<include refid="condition" />
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -122,73 +98,23 @@
id desc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC005 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC005 WHERE 1=1
<include refid="condition" />
<include refid="condition"/>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCode">
plan_code = #planCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="commitStatus">
commit_status = #commitStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishDate">
finish_date = #finishDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC005 (id,
INSERT INTO ${hggpSchema}.HGSC005 (
mat_id, <!-- 物料清单ID -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
......@@ -203,22 +129,20 @@
dep_name, <!-- 部门名称 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
created_time <!-- 创建时间 -->
) VALUES (
#matId#, #companyCode#, #companyName#, #projCode#, #projName#, #planCode#, #commitStatus#, #finishDate#,
#isSchedule#, #accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#
)
VALUES (#id#, #matId#, #companyCode#, #companyName#, #projCode#, #projName#, #planCode#, #commitStatus#, #finishDate#, #isSchedule#, #accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC005 WHERE
id = #id#
DELETE FROM ${hggpSchema}.HGSC005 WHERE ID = #id#
</delete>
<delete id="delete_by_mat_id">
DELETE FROM ${hggpSchema}.HGSC005 WHERE
mat_id = #matId#
DELETE FROM ${hggpSchema}.HGSC005 WHERE MAT_ID = #matId#
</delete>
<update id="update">
......@@ -242,11 +166,17 @@
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
WHERE id = #id#
</update>
<!-- 修改排产状态 -->
<update id="updateIsSchedule">
UPDATE ${hggpSchema}.HGSC005
SET
IS_SCHEDULE = #isSchedule#,
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
<update id="batch_commit">
UPDATE ${hggpSchema}.HGSC005
......
......@@ -2,6 +2,45 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC005A">
<sql id="column">
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
company_code as "companyCode", <!-- 公司编码 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<!--<include refid="HGXSDataAuth.authCondition"/>-->
<isNotEmpty prepend=" AND " property="id">
......@@ -122,42 +161,7 @@
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
company_code as "companyCode", <!-- 公司编码 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
<include refid="column"/>
FROM ${hggpSchema}.HGSC005A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
......@@ -165,7 +169,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
product_type asc , product_name, process_order desc
product_type asc, product_code desc, process_order desc
</isEmpty>
</dynamic>
......@@ -388,8 +392,17 @@
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
WHERE id = #id#
</update>
<!-- 修改计划时间 -->
<update id="updatePlanDate">
UPDATE ${hggpSchema}.HGSC005A
SET
plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
<include refid="SqlBase.updateRevise"/>
WHERE id = #id#
</update>
<select id="queryProcessComboBox" parameterClass="java.util.HashMap"
......
......@@ -43,6 +43,7 @@ import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -55,6 +56,7 @@ import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -693,26 +695,36 @@ public class HGSCTools {
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC005A> queryByMatId(Long matId){
AssertUtils.isTrue(Objects.isNull(matId)||matId<=0, "物料清单ID不能为空!");
// 存货档案单位转换(米)
private final static BigDecimal unitConver = new BigDecimal(1000);
// 基础工时
private final static BigDecimal baseWorkHour = new BigDecimal(8);
// 完成日期差异天数
private final static Integer finishDateDiffDay = 3;
public static List<HGSC005A> queryByMatId(Long matId) {
AssertUtils.isTrue(Objects.isNull(matId) || matId <= 0, "物料清单ID不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_mat_id, matId);
List<HGSC005A> results = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
private static List<HGSC005A> generatorNewPlanDetail(List<HGSC005A> hgsc005aList){
List<String> inventCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct().collect(Collectors.toList());
private static List<HGSC005A> generatorNewPlanDetail(List<HGSC005A> hgsc005aList) {
List<String> inventCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct()
.collect(Collectors.toList());
//通过存货档案编码查询存货档案工序
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes);
AssertUtils.isEmpty(hgpz005AList, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!",inventCodes));
AssertUtils.isEmpty(hgpz005AList, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!", inventCodes));
List<HGSC005A> hgsc005AList = new ArrayList<>();
hgsc005aList.forEach(hgsc005a->{
List<HGPZ005A> filterHgpz005a = hgpz005AList.stream().filter(o->o.getInventCode().equals(hgsc005a.getProductCode())).collect(Collectors.toList());
AssertUtils.isEmpty(filterHgpz005a, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!",hgsc005a.getProductName()));
hgsc005aList.forEach(hgsc005a -> {
List<HGPZ005A> filterHgpz005a = hgpz005AList.stream()
.filter(o -> o.getInventCode().equals(hgsc005a.getProductCode())).collect(Collectors.toList());
AssertUtils.isEmpty(filterHgpz005a,
String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!", hgsc005a.getProductName()));
filterHgpz005a.forEach(pz -> {
HGSC005A obj = new HGSC005A();
BeanUtils.copyProperties(hgsc005a,obj);
BeanUtils.copyProperties(hgsc005a, obj);
obj.setInventProcessId(pz.getId());
obj.setProcessCode(pz.getProcessCode());
obj.setProcessName(pz.getProcessName());
......@@ -723,14 +735,14 @@ public class HGSCTools {
return hgsc005AList;
}
private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){
private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a) {
//通过存货档案编码查询存货档案工序
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCode(hgsc005a.getProductCode());
AssertUtils.isEmpty(hgpz005AList, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!",hgsc005a.getProductName()));
AssertUtils.isEmpty(hgpz005AList, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!", hgsc005a.getProductName()));
List<HGSC005A> hgsc005AList = new ArrayList<>();
hgpz005AList.forEach(pz -> {
HGSC005A obj = new HGSC005A();
BeanUtils.copyProperties(hgsc005a,obj);
BeanUtils.copyProperties(hgsc005a, obj);
obj.setInventProcessId(pz.getId());
obj.setProcessCode(pz.getProcessCode());
obj.setProcessName(pz.getProcessName());
......@@ -740,29 +752,34 @@ public class HGSCTools {
return hgsc005AList;
}
private static Map<Long,Optional<HGSC005A>> queryOldPlanDetail(List<HGSC005A> hgsc005aList){
List<String> productCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct().collect(Collectors.toList());
private static Map<Long, Optional<HGSC005A>> queryOldPlanDetail(List<HGSC005A> hgsc005aList) {
List<String> productCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct()
.collect(Collectors.toList());
Map paramMap = new HashMap();
//因为提交时肯定matid相同,直接取第一个即可
paramMap.put(HGSC005A.FIELD_mat_id, hgsc005aList.get(0).getMatId());
paramMap.put("productCodes", productCodes);
List<HGSC005A> oldObjList = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
Map<Long,Optional<HGSC005A>> returnOldObjMap = new LinkedHashMap<>();
hgsc005aList.forEach(hgsc005a->{
Map<Long, Optional<HGSC005A>> returnOldObjMap = new LinkedHashMap<>();
hgsc005aList.forEach(hgsc005a -> {
//构建计划物料明细ID唯一
if(hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode())==0){
List<HGSC005A> oldObjFilterList = oldObjList.stream().filter(o->o.getProductCode().equals(hgsc005a.getProductCode())
&& o.getMatDetailId().compareTo(hgsc005a.getMatDetailId())==0)
if (hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode()) == 0) {
List<HGSC005A> oldObjFilterList = oldObjList.stream()
.filter(o -> o.getProductCode().equals(hgsc005a.getProductCode())
&& o.getMatDetailId().compareTo(hgsc005a.getMatDetailId()) == 0)
.collect(Collectors.toList());
Map<Long,Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId,Collectors.maxBy(
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList)
.orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity))));
returnOldObjMap.putAll(oldObjMap);
}else{
List<HGSC005A> oldObjFilterList = oldObjList.stream().filter(o->o.getProductCode().equals(hgsc005a.getProductCode()))
} else {
List<HGSC005A> oldObjFilterList = oldObjList.stream()
.filter(o -> o.getProductCode().equals(hgsc005a.getProductCode()))
.collect(Collectors.toList());
Map<Long,Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId,Collectors.maxBy(
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList)
.orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity))));
returnOldObjMap.putAll(oldObjMap);
}
......@@ -771,9 +788,10 @@ public class HGSCTools {
return returnOldObjMap;
}
private static Map<String,HGSC005A> queryOldPartPlanDetail(List<HGSC005A> hgsc005aList){
if(CollectionUtils.isNotEmpty(hgsc005aList)) {
List<String> productCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct().collect(Collectors.toList());
private static Map<String, HGSC005A> queryOldPartPlanDetail(List<HGSC005A> hgsc005aList) {
if (CollectionUtils.isNotEmpty(hgsc005aList)) {
List<String> productCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).distinct()
.collect(Collectors.toList());
Map paramMap = new HashMap();
//因为提交时肯定matid相同,直接取第一个即可
paramMap.put(HGSC005A.FIELD_mat_id, hgsc005aList.get(0).getMatId());
......@@ -790,22 +808,22 @@ public class HGSCTools {
return null;
}
private static Map<Long,Optional<HGSC005A>> queryOldPlanDetail(HGSC005A hgsc005a){
private static Map<Long, Optional<HGSC005A>> queryOldPlanDetail(HGSC005A hgsc005a) {
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_mat_id, hgsc005a.getMatId());
paramMap.put(HGSC005A.FIELD_product_code, hgsc005a.getProductCode());
//构建计划物料明细ID唯一
if(hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode())==0){
if (hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode()) == 0) {
paramMap.put(HGSC005A.FIELD_mat_detail_id, hgsc005a.getMatDetailId());
}
List<HGSC005A> oldObjList = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
Map<Long,Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId,Collectors.maxBy(
Map<Long, Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId, Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity))));
return oldObjMap;
}
public static List<HGSC005A> saveList(List<HGSC005A> hgsc005aList){
public static List<HGSC005A> saveList(List<HGSC005A> hgsc005aList) {
checkUpdateData(hgsc005aList);
hgsc005aList = constructObj(hgsc005aList);
List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005aList);
......@@ -825,8 +843,8 @@ public class HGSCTools {
// createList.add(o);
// }
// });
if(CollectionUtils.isNotEmpty(hgsc005AList)){
DaoUtils.insertBatch(HGSC005A.INSERT,hgsc005AList);
if (CollectionUtils.isNotEmpty(hgsc005AList)) {
DaoUtils.insertBatch(HGSC005A.INSERT, hgsc005AList);
}
// if(CollectionUtils.isNotEmpty(updateList)){
// DaoUtils.updateBatch(HGSC005A.UPDATE,updateList);
......@@ -834,112 +852,116 @@ public class HGSCTools {
return hgsc005aList;
}
public static HGSC005A save(HGSC005A hgsc005a){
public static HGSC005A save(HGSC005A hgsc005a) {
checkUpdateData(hgsc005a);
constructObj(hgsc005a);
List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
Map<Long, Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
List<HGSC005A> createList = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
hgsc005AList.forEach(o -> {
Optional<HGSC005A> op = oldObjMap.get(o.getInventProcessId());
if(Objects.nonNull(op)){
if (Objects.nonNull(op)) {
HGSC005A uo = op.get();
uo.setQuantity(uo.getQuantity()+o.getQuantity());
uo.setUnfinishQuantity(uo.getUnfinishQuantity()+o.getQuantity());
handleWeight(hgsc005a,uo);
uo.setQuantity(uo.getQuantity() + o.getQuantity());
uo.setUnfinishQuantity(uo.getUnfinishQuantity() + o.getQuantity());
handleWeight(hgsc005a, uo);
updateList.add(uo);
}else{
handleWeight(hgsc005a,o);
} else {
handleWeight(hgsc005a, o);
createList.add(o);
}
});
if(CollectionUtils.isNotEmpty(createList)){
if (CollectionUtils.isNotEmpty(createList)) {
createList.forEach(obj -> {
DaoUtils.insert(HGSC005A.INSERT,obj);
DaoUtils.insert(HGSC005A.INSERT, obj);
});
}
if(CollectionUtils.isNotEmpty(updateList)){
if (CollectionUtils.isNotEmpty(updateList)) {
updateList.forEach(obj -> {
DaoUtils.update(HGSC005A.UPDATE,obj);
DaoUtils.update(HGSC005A.UPDATE, obj);
});
}
return hgsc005a;
}
public static HGSC005A update(HGSC005A hgsc005a){
public static HGSC005A update(HGSC005A hgsc005a) {
checkUpdateData(hgsc005a);
constructObj(hgsc005a);
List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
Map<Long, Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
List<HGSC005A> createList = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
hgsc005AList.forEach(o -> {
Optional<HGSC005A> op = oldObjMap.get(o.getInventProcessId());
if(Objects.nonNull(op)){
if (Objects.nonNull(op)) {
HGSC005A uo = op.get();
uo.setQuantity(o.getQuantity());
uo.setUnfinishQuantity(o.getQuantity()-uo.getFinishQuantity());
handleWeight(hgsc005a,uo);
uo.setUnfinishQuantity(o.getQuantity() - uo.getFinishQuantity());
handleWeight(hgsc005a, uo);
updateList.add(uo);
}else{
handleWeight(hgsc005a,o);
} else {
handleWeight(hgsc005a, o);
createList.add(o);
}
});
if(CollectionUtils.isNotEmpty(createList)){
if (CollectionUtils.isNotEmpty(createList)) {
createList.forEach(obj -> {
DaoUtils.insert(HGSC005A.INSERT,obj);
DaoUtils.insert(HGSC005A.INSERT, obj);
});
}
if(CollectionUtils.isNotEmpty(updateList)){
if (CollectionUtils.isNotEmpty(updateList)) {
updateList.forEach(obj -> {
DaoUtils.update(HGSC005A.UPDATE,obj);
DaoUtils.update(HGSC005A.UPDATE, obj);
});
}
return hgsc005a;
}
public static void delete(HGSC005A hgsc005a){
public static void delete(HGSC005A hgsc005a) {
checkUpdateData(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
Map<Long, Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
List<Long> deleteIds = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
oldObjMap.forEach((k,v)->{
oldObjMap.forEach((k, v) -> {
HGSC005A oldObj = v.get();
if(oldObj.getQuantity()-hgsc005a.getQuantity()<=0){
handleWeight(hgsc005a,oldObj);
if (oldObj.getQuantity() - hgsc005a.getQuantity() <= 0) {
handleWeight(hgsc005a, oldObj);
deleteIds.add(oldObj.getId());
}else{
oldObj.setQuantity(oldObj.getQuantity()-hgsc005a.getQuantity());
oldObj.setUnfinishQuantity(oldObj.getQuantity()-oldObj.getFinishQuantity());
handleWeight(hgsc005a,oldObj);
} else {
oldObj.setQuantity(oldObj.getQuantity() - hgsc005a.getQuantity());
oldObj.setUnfinishQuantity(oldObj.getQuantity() - oldObj.getFinishQuantity());
handleWeight(hgsc005a, oldObj);
updateList.add(oldObj);
}
});
if(CollectionUtils.isNotEmpty(deleteIds)){
if (CollectionUtils.isNotEmpty(deleteIds)) {
List<HGSC005A> dbList = queryByMatId(hgsc005a.getMatId());
//如果全部删除则删除主表
if(deleteIds.size() == dbList.size()){
DaoUtils.update(HGSC005.DELETE_BY_MAT_ID,new HashMap<String,Object>(){{put(HGSC005.FIELD_mat_id,hgsc005a.getMatId());}});
if (deleteIds.size() == dbList.size()) {
DaoUtils.update(HGSC005.DELETE_BY_MAT_ID, new HashMap<String, Object>() {{
put(HGSC005.FIELD_mat_id, hgsc005a.getMatId());
}});
}
DaoUtils.update(HGSC005A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",deleteIds);}});
DaoUtils.update(HGSC005A.BATCH_DELETE, new HashMap<String, Object>() {{
put("ids", deleteIds);
}});
}
if(CollectionUtils.isNotEmpty(updateList)){
DaoUtils.updateBatch(HGSC005A.UPDATE,updateList);
if (CollectionUtils.isNotEmpty(updateList)) {
DaoUtils.updateBatch(HGSC005A.UPDATE, updateList);
}
if(hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode())==0
&& CollectionUtils.isNotEmpty(hgsc005a.getPartList())){
if (hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode()) == 0
&& CollectionUtils.isNotEmpty(hgsc005a.getPartList())) {
deletePartList(hgsc005a.getPartList());
}
}
public static void deletePartList(List<HGSC005A> hgsc005aList){
public static void deletePartList(List<HGSC005A> hgsc005aList) {
List<Long> deleteIds = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(hgsc005aList)) {
Map<String, HGSC005A> hgsc005aMap = hgsc005aList.stream().collect(Collectors.toMap(HGSC005A::getProductCode, o -> o, (o1, o2) -> {
if (CollectionUtils.isNotEmpty(hgsc005aList)) {
Map<String, HGSC005A> hgsc005aMap = hgsc005aList.stream()
.collect(Collectors.toMap(HGSC005A::getProductCode, o -> o, (o1, o2) -> {
o1.setQuantity(o1.getQuantity() + o2.getQuantity());
o1.setTotalWeight(o1.getSingleWeight().multiply(new BigDecimal(o1.getQuantity())));
return o1;
......@@ -948,7 +970,7 @@ public class HGSCTools {
Map<String, HGSC005A> oldObjMap = queryOldPartPlanDetail(hgsc005aList);
if (Objects.nonNull(oldObjMap)) {
oldObjMap.forEach((k, oldObj) -> {
if(Objects.nonNull(oldObj)) {
if (Objects.nonNull(oldObj)) {
HGSC005A hgsc005a = hgsc005aMap.get(k.split("#")[0]);
if (oldObj.getQuantity() - hgsc005a.getQuantity() <= 0) {
handleWeight(hgsc005a, oldObj);
......@@ -963,26 +985,31 @@ public class HGSCTools {
});
}
}
if(CollectionUtils.isNotEmpty(deleteIds)){
if (CollectionUtils.isNotEmpty(deleteIds)) {
Long matId = hgsc005aList.get(0).getMatId();
List<HGSC005A> dbList = queryByMatId(matId);
//如果全部删除则删除主表
if(deleteIds.size() == dbList.size()){
DaoUtils.update(HGSC005.DELETE_BY_MAT_ID,new HashMap<String,Object>(){{put(HGSC005.FIELD_mat_id,matId);}});
if (deleteIds.size() == dbList.size()) {
DaoUtils.update(HGSC005.DELETE_BY_MAT_ID, new HashMap<String, Object>() {{
put(HGSC005.FIELD_mat_id, matId);
}});
}
DaoUtils.update(HGSC005A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",deleteIds);}});
DaoUtils.update(HGSC005A.BATCH_DELETE, new HashMap<String, Object>() {{
put("ids", deleteIds);
}});
}
if(CollectionUtils.isNotEmpty(updateList)){
DaoUtils.updateBatch(HGSC005A.UPDATE,updateList);
if (CollectionUtils.isNotEmpty(updateList)) {
DaoUtils.updateBatch(HGSC005A.UPDATE, updateList);
}
}
private static void handleWeight(HGSC005A hgsc005a, HGSC005A target){
if(Objects.nonNull(hgsc005a.getSingleWeight())) {
private static void handleWeight(HGSC005A hgsc005a, HGSC005A target) {
if (Objects.nonNull(hgsc005a.getSingleWeight())) {
target.setSingleWeight(hgsc005a.getSingleWeight());
target.setTotalWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getQuantity())));
target.setFinishWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getFinishQuantity())));
target.setUnfinishWeight(hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getUnfinishQuantity())));
target.setUnfinishWeight(
hgsc005a.getSingleWeight().multiply(new BigDecimal(target.getUnfinishQuantity())));
}
}
......@@ -992,15 +1019,15 @@ public class HGSCTools {
* @param hgsc005aList
*/
private static void checkUpdateData(List<HGSC005A> hgsc005aList) {
for(HGSC005A hgsc005a : hgsc005aList){
for (HGSC005A hgsc005a : hgsc005aList) {
checkUpdateData(hgsc005a);
}
}
public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList){
public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList) {
HGSC005 hgsc005 = THGSC005.queryByMatId(hgsc005aList.get(0).getMatId());
List<HGSC005A> result = new ArrayList<>();
Map<String,HGSC005A> hgsc005AMap = new HashMap<>();
Map<String, HGSC005A> hgsc005AMap = new HashMap<>();
hgsc005aList.forEach(hgsc005a -> {
hgsc005a.setPlanCode(hgsc005.getPlanCode());
hgsc005a.setCompanyCode(hgsc005.getCompanyCode());
......@@ -1014,31 +1041,25 @@ public class HGSCTools {
hgsc005a.setFinishQuantity(0);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
//零件
if(hgsc005a.getProductType().compareTo(ProductTypeEnum.PART.getCode())==0){
if (hgsc005a.getProductType().compareTo(ProductTypeEnum.PART.getCode()) == 0) {
HGSC005A hisObj = hgsc005AMap.get(hgsc005a.getProductCode());
if(Objects.nonNull(hisObj)){
if (Objects.nonNull(hisObj)) {
hgsc005a.setQuantity(hgsc005a.getQuantity() + hisObj.getQuantity());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setTotalWeight(hgsc005a.getTotalWeight().add(hisObj.getTotalWeight()));
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
}
hgsc005AMap.put(hgsc005a.getProductCode(),hgsc005a);
}else{
hgsc005AMap.put(hgsc005a.getProductCode(), hgsc005a);
} else {
result.add(hgsc005a);
}
});
if(MapUtils.isNotEmpty(hgsc005AMap)){
if (MapUtils.isNotEmpty(hgsc005AMap)) {
result.addAll(hgsc005AMap.values().stream().collect(Collectors.toList()));
}
return result;
}
//存货档案单位转换(米)
private final static BigDecimal unitConver = new BigDecimal(1000);
//基础工时
private final static BigDecimal baseWorkHour = new BigDecimal(8);
private final static Integer finishDateDiffDay = new Integer(-3);
/**
* 校验修改的数据
*
......@@ -1091,135 +1112,289 @@ public class HGSCTools {
/**
* 排产
*
* @param dbSc005 主计划信息
* @param queryMap
* @param sortType
* @param sortType A:正序,D:倒序
* @return
*/
public static int schedule(Map queryMap, String sortType) {
List<HGSC005A> hgsc005AList = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap);
// hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder()));
//通过工序编码查询工序设置
List<String> processCodes = hgsc005AList.stream().map(HGSC005A::getProcessCode)
.collect(Collectors.toList());
List<HGSJ001> hgsj001List = HGSJTools.Hgsj001.queryByProcessCodes(processCodes);
//通过产品编码查询存货档案
List<String> productCodes = hgsc005AList.stream().map(HGSC005A::getProductCode)
.collect(Collectors.toList());
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(productCodes);
//通过存货档案工序ID查询存货档案工序
List<Long> inventProcessIds = hgsc005AList.stream().map(HGSC005A::getInventProcessId)
.collect(Collectors.toList());
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByIds(inventProcessIds);
//筛选计划构建,并按产品分组
Map<String, List<HGSC005A>> strctMap = hgsc005AList.stream()
.filter(o -> o.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode()) == 0)
public static int schedule(HGSC005 dbSc005, Map queryMap, String sortType) {
// 查询计划明细数据
List<HGSC005A> dbSc005As = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap);
// 正序排序
if (CommonConstant.SortType.ASC.equals(sortType)) {
dbSc005As.sort(Comparator.comparingInt(HGSC005A::getProductType).reversed()
.thenComparing(HGSC005A::getProductCode).reversed()
.thenComparingLong(HGSC005A::getProcessOrder));
}
// 通过工序编码查询工序设置
Map<String, HGSJ001> dbSj001Map = HGSJTools.Hgsj001.mapByCode(
ObjectUtils.listEpKey(dbSc005As, HGSC005A.FIELD_process_code));
// 通过产品编码查询存货档案
List<HGPZ005> dbPz005s = HGPZTools.HgPz005.listByInventCodes(
ObjectUtils.listEpKey(dbSc005As, HGSC005A.FIELD_product_code));
// 通过存货档案工序ID查询存货档案工序
List<HGPZ005A> dbPz005As = HGPZTools.HgPz005A.queryByIds(
ObjectUtils.listEpKey(dbSc005As, HGSC005A.FIELD_invent_process_id));
// 筛选计划构件,并按产品分组
Map<String, List<HGSC005A>> structMap = dbSc005As.stream()
.filter(o -> o.getProductType().equals(ProductTypeEnum.STRUCT.getCode()))
.collect(Collectors.groupingBy(HGSC005A::getProductCode));
List<HGSC005A> partList = hgsc005AList.stream()
.filter(o -> o.getProductType().compareTo(ProductTypeEnum.PART.getCode()) == 0)
// 筛选零件
List<HGSC005A> parts = dbSc005As.stream()
.filter(o -> o.getProductType().equals(ProductTypeEnum.PART.getCode()))
.collect(Collectors.toList());
// 计算工序时间
if (CommonConstant.SortType.ASC.equals(sortType)) {
calcPlanDataAsc(dbSc005, dbSj001Map, dbPz005s, dbPz005As, structMap, parts);
} else {
calcPlanDataDesc(dbSj001Map, dbPz005s, dbPz005As, structMap, parts);
}
return dbSc005As.size();
}
/**
* 按照正序的方式计算工序的时间
*
* @param dbSc005
* @param dbSj001Map
* @param dbPz005s
* @param dbPz005As
* @param structMap
* @param parts
*/
private static void calcPlanDataAsc(HGSC005 dbSc005, Map<String, HGSJ001> dbSj001Map, List<HGPZ005> dbPz005s,
List<HGPZ005A> dbPz005As, Map<String, List<HGSC005A>> structMap, List<HGSC005A> parts) {
String maxDate = "";
BigDecimal remainder = BigDecimal.ZERO;
// 计算零件开始结束时间
for (HGSC005A iSc005A : parts) {
// 找出工序信息
HGSJ001 dbSj001 = dbSj001Map.get(iSc005A.getProcessCode());
AssertUtils.isNull(dbSj001, String.format("工序【%s】不存在", iSc005A.getProcessCode()));
// 计算工序时长
remainder = calculateWordHourAsc(dbSc005, iSc005A, dbSj001, dbPz005s, dbPz005As, maxDate, remainder);
// 设置最大时间
maxDate = StringUtils.isBlank(maxDate) || DateUtils.isAfter(iSc005A.getPlanEndDate(), maxDate)
? iSc005A.getPlanEndDate() : maxDate;
DaoUtils.update(HgScSqlConstant.HgSc005A.UPDATE_PLAN_DATE, iSc005A);
}
// 计算构件开始结束时间
for (Map.Entry<String, List<HGSC005A>> structEntry : structMap.entrySet()) {
for (HGSC005A iSc005A : structEntry.getValue()) {
// 找出工序信息
HGSJ001 dbSj001 = dbSj001Map.get(iSc005A.getProcessCode());
AssertUtils.isNull(dbSj001, String.format("工序【%s】不存在", iSc005A.getProcessCode()));
// 计算工序时长
remainder = calculateWordHourAsc(dbSc005, iSc005A, dbSj001, dbPz005s, dbPz005As, maxDate,
remainder);
maxDate = StringUtils.isBlank(maxDate) || DateUtils.isAfter(iSc005A.getPlanEndDate(), maxDate)
? iSc005A.getPlanEndDate() : maxDate;
DaoUtils.update(HgScSqlConstant.HgSc005A.UPDATE_PLAN_DATE, iSc005A);
}
}
}
/**
* 按照倒序的方式计算工序的时间
*
* @param dbSj001Map
* @param dbPz005s
* @param dbPz005As
* @param structMap
* @param parts
*/
private static void calcPlanDataDesc(Map<String, HGSJ001> dbSj001Map, List<HGPZ005> dbPz005s,
List<HGPZ005A> dbPz005As,
Map<String, List<HGSC005A>> structMap, List<HGSC005A> parts) {
String minDate = "";
BigDecimal remainder = new BigDecimal(0);
for (String key : strctMap.keySet()) {
// 计算构件开始结束时间
for (Map.Entry<String, List<HGSC005A>> structEntry : structMap.entrySet()) {
String endDate = "";
for (HGSC005A planInfo : strctMap.get(key)) {
remainder = calculateWordHour(planInfo, hgsj001List, hgpz005List, hgpz005AList, endDate, remainder);
if (StringUtils.isBlank(minDate)) {
minDate = planInfo.getPlanStartDate();
} else {
minDate = DateUtil.toDate(planInfo.getPlanStartDate(), DateUtil.DATE10_PATTERN)
.compareTo(DateUtil.toDate(minDate, DateUtil.DATE10_PATTERN)) <= 0
? planInfo.getPlanStartDate() : minDate;
for (HGSC005A iSc005A : structEntry.getValue()) {
// 找出工序信息
HGSJ001 dbSj001 = dbSj001Map.get(iSc005A.getProcessCode());
AssertUtils.isNull(dbSj001, String.format("工序【%s】不存在", iSc005A.getProcessCode()));
// 计算工序时长
remainder = calculateWordHourDesc(iSc005A, dbSj001, dbPz005s, dbPz005As, endDate, remainder);
minDate = StringUtils.isBlank(minDate) || DateUtils.isBefore(iSc005A.getPlanStartDate(), minDate)
? iSc005A.getPlanStartDate() : minDate;
DaoUtils.update(HgScSqlConstant.HgSc005A.UPDATE_PLAN_DATE, iSc005A);
}
}
// 计算零件开始结束时间
for (HGSC005A iSc005A : parts) {
// 找出工序信息
HGSJ001 dbSj001 = dbSj001Map.get(iSc005A.getProcessCode());
AssertUtils.isNull(dbSj001, String.format("工序【%s】不存在", iSc005A.getProcessCode()));
// 计算工序时长
remainder = calculateWordHourDesc(iSc005A, dbSj001, dbPz005s, dbPz005As, minDate, remainder);
minDate = StringUtils.isBlank(minDate) || DateUtils.isBefore(iSc005A.getPlanStartDate(), minDate)
? iSc005A.getPlanStartDate() : minDate;
DaoUtils.update(HgScSqlConstant.HgSc005A.UPDATE_PLAN_DATE, iSc005A);
}
}
/**
* @param dbSc005A
* @param dbSj001
* @param dbPz005s
* @param dbPz005As
* @param startDate
* @param remainder
* @return
*/
private static BigDecimal calculateWordHourAsc(HGSC005 dbSc005, HGSC005A dbSc005A, HGSJ001 dbSj001,
List<HGPZ005> dbPz005s, List<HGPZ005A> dbPz005As, String startDate, BigDecimal remainder) {
// 计算开始时间
startDate = handleStartDate(startDate, dbSc005, dbSj001);
dbSc005A.setPlanStartDate(startDate);
// 计算工序时间
BigDecimal workHour = calculateWordHour(dbSc005A, dbSj001, dbPz005s, dbPz005As, remainder);
BigDecimal day = workHour.divide(baseWorkHour, 0, ROUND_DOWN);
if (day.compareTo(BigDecimal.ZERO) > 0) {
startDate = LocalDate.parse(startDate).plusDays(day.intValue()).toString();
}
DaoUtils.update(HGSC005A.UPDATE, planInfo);
dbSc005A.setPlanEndDate(startDate);
return workHour.remainder(baseWorkHour);
}
/**
* @param dbSc005A
* @param dbSj001
* @param dbPz005s
* @param dbPz005As
* @param endDate
* @param remainder
* @return
*/
private static BigDecimal calculateWordHourDesc(HGSC005A dbSc005A, HGSJ001 dbSj001,
List<HGPZ005> dbPz005s, List<HGPZ005A> dbPz005As, String endDate, BigDecimal remainder) {
// 计算结束时间
endDate = handleEndDate(endDate, dbSc005A, dbSj001);
dbSc005A.setPlanEndDate(endDate);
// 计算工序时间
BigDecimal workHour = calculateWordHour(dbSc005A, dbSj001, dbPz005s, dbPz005As, remainder);
BigDecimal day = workHour.divide(baseWorkHour, 0, ROUND_DOWN);
if (day.compareTo(BigDecimal.ZERO) > 0) {
endDate = LocalDate.parse(endDate).minusDays(day.intValue()).toString();
}
for (HGSC005A planInfo : partList) {
remainder = calculateWordHour(planInfo, hgsj001List, hgpz005List, hgpz005AList, minDate, remainder);
if (StringUtils.isBlank(minDate)) {
minDate = planInfo.getPlanStartDate();
} else {
minDate = DateUtil.toDate(planInfo.getPlanStartDate(), DateUtil.DATE10_PATTERN)
.compareTo(DateUtil.toDate(minDate, DateUtil.DATE10_PATTERN)) <= 0
? planInfo.getPlanStartDate() : minDate;
}
DaoUtils.update(HGSC005A.UPDATE, planInfo);
}
return hgsc005AList.size();
}
private static String handleEndDate(String endDate, HGSC005A planInfo) {
if (StringUtils.isBlank(endDate) && StringUtils.isNotBlank(planInfo.getFinishDate())) {
endDate = DateUtil.toDateStr(DateUtils.addDays(DateUtil.toDate(planInfo.getFinishDate(),
DateUtil.DATE10_PATTERN), finishDateDiffDay.intValue()), DateUtil.DATE10_PATTERN);
}
return endDate;
}
private static BigDecimal calculateWordHour(HGSC005A planInfo, List<HGSJ001> hgsj001List,
List<HGPZ005> hgpz005List, List<HGPZ005A> hgpz005AList, String endDate, BigDecimal remainder) {
endDate = handleEndDate(endDate, planInfo);
planInfo.setPlanEndDate(endDate);
AtomicReference<BigDecimal> workHour = new AtomicReference<>(new BigDecimal(0));
BigDecimal finalRemainder = remainder;
hgsj001List.stream().forEach(sj -> {
if (StringUtils.equals(sj.getProcessCode(), planInfo.getProcessCode())) {
hgpz005AList.forEach(productProcess -> {
if (productProcess.getId().compareTo(planInfo.getInventProcessId()) == 0) {
BigDecimal composingCoeff = productProcess.getComposingCoeff();
hgpz005List.forEach(product->{
if(StringUtils.equals(product.getInventCode(),planInfo.getProductCode())){
//额定工时
BigDecimal timing = sj.getStandardJob().multiply(sj.getStandardDays()).divide(sj.getStandardNum(),2, ROUND_DOWN);
ComputeTypeEnum computeType = ComputeTypeEnum.getEnumByCode(sj.getComputeType());
switch (computeType){
dbSc005A.setPlanStartDate(endDate);
return workHour.remainder(baseWorkHour);
}
/**
* @param dbSc005A
* @param dbSj001
* @param dbPz005s
* @param dbPz005As
* @param remainder
* @return
*/
private static BigDecimal calculateWordHour(HGSC005A dbSc005A, HGSJ001 dbSj001,
List<HGPZ005> dbPz005s, List<HGPZ005A> dbPz005As, BigDecimal remainder) {
AtomicReference<BigDecimal> workHour = new AtomicReference<>(BigDecimal.ZERO);
for (HGPZ005A dbPz005A : dbPz005As) {
if (dbPz005A.getId().compareTo(dbSc005A.getInventProcessId()) != 0) {
continue;
}
BigDecimal composingCoeff = dbPz005A.getComposingCoeff();
for (HGPZ005 dbPz005 : dbPz005s) {
if (!StringUtils.equals(dbPz005.getInventCode(), dbSc005A.getProductCode())) {
continue;
}
// 额定工时
BigDecimal timing = dbSj001.getStandardJob().multiply(dbSj001.getStandardDays())
.divide(dbSj001.getStandardNum(), 2, ROUND_DOWN);
ComputeTypeEnum computeType = ComputeTypeEnum.getEnumByCode(dbSj001.getComputeType());
switch (computeType) {
case CD:
workHour.set(product.getLength().multiply(new BigDecimal(planInfo.getQuantity())).divide(unitConver, 2, ROUND_DOWN).multiply(composingCoeff)
.divide(timing,2, ROUND_DOWN)
.multiply(baseWorkHour).add(finalRemainder));
workHour.set(dbPz005.getLength().multiply(new BigDecimal(dbSc005A.getQuantity()))
.divide(unitConver, 2, ROUND_DOWN).multiply(composingCoeff)
.divide(timing, 2, ROUND_DOWN)
.multiply(baseWorkHour).add(remainder));
break;
case SL:
workHour.set(new BigDecimal(planInfo.getQuantity()).multiply(composingCoeff)
.divide(timing,2, ROUND_DOWN)
.multiply(baseWorkHour).add(finalRemainder));
workHour.set(new BigDecimal(dbSc005A.getQuantity()).multiply(composingCoeff)
.divide(timing, 2, ROUND_DOWN)
.multiply(baseWorkHour).add(remainder));
break;
case ZL:
workHour.set(planInfo.getTotalWeight().multiply(composingCoeff)
.divide(timing,2, ROUND_DOWN)
.multiply(baseWorkHour).add(finalRemainder));
workHour.set(dbSc005A.getTotalWeight().multiply(composingCoeff)
.divide(timing, 2, ROUND_DOWN)
.multiply(baseWorkHour).add(remainder));
break;
default:
break;
}
}
});
}
});
return workHour.get().divide(baseWorkHour, 0, ROUND_DOWN);
}
});
BigDecimal day = workHour.get().divide(baseWorkHour, 0, ROUND_DOWN);
remainder = workHour.get().remainder(baseWorkHour);
if(day.compareTo(new BigDecimal(0))>0) {
endDate = DateUtil.toDateStr(DateUtils.addDays(DateUtil.toDate(endDate,DateUtil.DATE10_PATTERN),day.negate().intValue()),DateUtil.DATE10_PATTERN);
/**
* 处理开始日期
*
* @param startDate
* @param dbSc005
* @param dbSj001
* @return
*/
private static String handleStartDate(String startDate, HGSC005 dbSc005, HGSJ001 dbSj001) {
// 计划的开始时间
LocalDate planStartDate = DateUtils.parseToDate(dbSc005.getCreatedTime());
if (StringUtils.isBlank(startDate)) {
return planStartDate.toString();
}
planInfo.setPlanStartDate(endDate);
return remainder;
// 计算重叠天数
LocalDate startLocalDate = LocalDate.parse(startDate);
LocalDate newLocalDate = startLocalDate.minusDays(dbSj001.getOverlapDay());
return newLocalDate.isBefore(planStartDate) ? planStartDate.toString() : newLocalDate.toString();
}
/**
* 处理结束日期
*
* @param endDate
* @param dbSc005A
* @return
*/
private static String handleEndDate(String endDate, HGSC005A dbSc005A, HGSJ001 dbSj001) {
LocalDate finishDate = LocalDate.parse(dbSc005A.getFinishDate()).minusDays(finishDateDiffDay);
if (StringUtils.isBlank(endDate)) {
return finishDate.toString();
}
public static class THGSC006{
public static void generatorOrder(List<HGSC005> hgsc005List, List<HGSC005A> hgsc005AList){
Map<String, Optional<HGSC005>> hgsc005Map = hgsc005List.stream().collect(Collectors.groupingBy(HGSC005::getPlanCode,Collectors.maxBy(
// 计算重叠天数
LocalDate endLocalDate = LocalDate.parse(endDate);
LocalDate newLocalDate = endLocalDate.plusDays(dbSj001.getOverlapDay());
return newLocalDate.isAfter(finishDate) ? finishDate.toString() : newLocalDate.toString();
}
}
/**
* @author:songx
* @date:2024/9/10,9:27
*/
public static class THGSC006 {
public static void generatorOrder(List<HGSC005> hgsc005List, List<HGSC005A> hgsc005AList) {
Map<String, Optional<HGSC005>> hgsc005Map = hgsc005List.stream()
.collect(Collectors.groupingBy(HGSC005::getPlanCode, Collectors.maxBy(
Comparator.comparingLong(HGSC005::getId))));
Map<String,List<HGSC005A>> hgsc005aMap = hgsc005AList.stream().collect(Collectors.groupingBy(HGSC005A::getPlanCode));
hgsc005Map.forEach((k,v) -> {
Map<String, List<HGSC005A>> hgsc005aMap = hgsc005AList.stream()
.collect(Collectors.groupingBy(HGSC005A::getPlanCode));
hgsc005Map.forEach((k, v) -> {
HGSC005 hgsc005 = v.get();
HGSC006 hgsc006 = constructObj(hgsc005);
List<HGSC006A> hgsc006AList = THGSC006A.constructObj(hgsc006,hgsc005aMap.get(hgsc005.getPlanCode()));
DaoUtils.insert(HGSC006.INSERT,hgsc006);
DaoUtils.insert(HGSC006A.INSERT,hgsc006AList);
List<HGSC006A> hgsc006AList = THGSC006A.constructObj(hgsc006, hgsc005aMap.get(hgsc005.getPlanCode()));
DaoUtils.insert(HGSC006.INSERT, hgsc006);
DaoUtils.insert(HGSC006A.INSERT, hgsc006AList);
});
}
public static HGSC006 constructObj(HGSC005 hgsc005){
public static HGSC006 constructObj(HGSC005 hgsc005) {
HGSC006 hgsc006 = new HGSC006();
hgsc006.setOrderCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC006_ORDER_CODE));
hgsc006.setMatId(hgsc005.getMatId());
......@@ -1234,12 +1409,16 @@ public class HGSCTools {
public static HGSC006 getByOrderCode(String orderCode) {
AssertUtils.isEmpty(orderCode, "订单编号不能为空!");
HGSC006 results = (HGSC006)DaoBase.getInstance().get(HGSC006.QUERY, HGSC006.FIELD_order_code, orderCode);
HGSC006 results = (HGSC006) DaoBase.getInstance().get(HGSC006.QUERY, HGSC006.FIELD_order_code, orderCode);
return results;
}
}
public static class THGSC006A{
/**
* @author:songx
* @date:2024/9/10,9:27
*/
public static class THGSC006A {
/**
* 锁
......@@ -1248,7 +1427,7 @@ public class HGSCTools {
* @return
*/
public static void lock(Long orderDetailId) {
if (Objects.isNull(orderDetailId)||orderDetailId<=0) {
if (Objects.isNull(orderDetailId) || orderDetailId <= 0) {
return;
}
Map queryMap = new HashMap();
......@@ -1256,13 +1435,13 @@ public class HGSCTools {
DaoBase.getInstance().update(HGSqlConstant.HGSC006A.LOCK, queryMap);
}
public static HGSC006A getById(Long orderDetailId){
AssertUtils.isTrue(Objects.isNull(orderDetailId)||orderDetailId<=0, "订单明细ID不能为空!");
HGSC006A results = (HGSC006A)DaoBase.getInstance().get(HGSC006A.QUERY, HGSC006A.FIELD_id, orderDetailId);
public static HGSC006A getById(Long orderDetailId) {
AssertUtils.isTrue(Objects.isNull(orderDetailId) || orderDetailId <= 0, "订单明细ID不能为空!");
HGSC006A results = (HGSC006A) DaoBase.getInstance().get(HGSC006A.QUERY, HGSC006A.FIELD_id, orderDetailId);
return results;
}
public static List<HGSC006A> constructObj(HGSC006 hgsc006,List<HGSC005A> hgsc005AList){
public static List<HGSC006A> constructObj(HGSC006 hgsc006, List<HGSC005A> hgsc005AList) {
List<HGSC006A> result = new ArrayList<>();
hgsc005AList.forEach(o -> {
HGSC006A hgsc006a = new HGSC006A();
......@@ -1316,7 +1495,7 @@ public class HGSCTools {
/**
* @author:songx
* @date:2024/9/8,9:41
* @date:2024/9/10,9:27
*/
public static class THGSC007 {
......@@ -1361,9 +1540,12 @@ public class HGSCTools {
return DaoBase.getInstance().query(HGSC007.QUERY, queryMap);
}
}
/**
* @author:songx
* @date:2024/9/10,9:27
*/
public static class THGSC008 {
public static HGSC008 getById(Long taskId) {
......@@ -1394,21 +1576,20 @@ public class HGSCTools {
hgsc008.setTotalWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc008.getQuantity())));
checkAddDate(hgsc008);
hgsc008.setWorkCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC008_WORK_CODE));
DaoUtils.insert(HGSC008.INSERT,hgsc008);
DaoUtils.insert(HGSC008.INSERT, hgsc008);
HGZLTools.THGZL002.add(hgsc008);
return hgsc008;
}
private static void checkAddDate(HGSC008 hgsc008){
private static void checkAddDate(HGSC008 hgsc008) {
// List<String> orgIdList = UserSessionUtils.getOrgId();
// AssertUtils.isEmpty(hgsc008.getGroupCode(),"生产任务班组信息异常,请联系管理员!");
// AssertUtils.isTrue(!orgIdList.contains(hgsc008.getGroupCode()),"非当前任务生产组用户,无法报工此任务!");
AssertUtils.isNull(hgsc008.getQuantity(),"报工数量不能为空!");
AssertUtils.isNull(hgsc008.getQuantity(), "报工数量不能为空!");
}
private static void cleanBaseInfo(HGSC008 hgsc008){
private static void cleanBaseInfo(HGSC008 hgsc008) {
hgsc008.setCreatedBy(null);
hgsc008.setCreatedName(null);
hgsc008.setCreatedTime(null);
......@@ -1422,22 +1603,31 @@ public class HGSCTools {
public static void delete(List<Long> ids) {
checkDeleteDate(ids);
DaoUtils.update(HGSC008.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
DaoUtils.update(HGSC008.BATCH_DELETE, new HashMap<String, Object>() {{
put("ids", ids);
}});
HGZLTools.THGZL002.deleteByWorkIds(ids);
ids.forEach( id -> {
ids.forEach(id -> {
HGSCTools.THGSC099.deleteByMatId(id, HGConstant.FileBizType.SCBG);
});
}
private static void checkDeleteDate(List<Long> ids){
private static void checkDeleteDate(List<Long> ids) {
List<HGZL002> hgzl002s = HGZLTools.THGZL002.listByWorkIds(ids);
List<String> workCodes = hgzl002s.stream().filter(o -> o.getCheckStatus().compareTo(CheckStatusEnum.CHECKED.getCode())==0).map(HGZL002::getWorkCode).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(workCodes)){
AssertUtils.isNotEmpty(workCodes,String.format("生产报工单[%s]已经质检完成,无法删除!",String.join(",",workCodes)));
List<String> workCodes = hgzl002s.stream()
.filter(o -> o.getCheckStatus().compareTo(CheckStatusEnum.CHECKED.getCode()) == 0)
.map(HGZL002::getWorkCode).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(workCodes)) {
AssertUtils.isNotEmpty(workCodes, String.format("生产报工单[%s]已经质检完成,无法删除!", String.join(",", workCodes)));
}
}
}
public static class THGSC099{
/**
* @author:songx
* @date:2024/9/10,9:27
*/
public static class THGSC099 {
public static List<HGSC099> listByMatId(Long matId, String bizType) {
Map queryMap = new HashMap();
......@@ -1466,8 +1656,8 @@ public class HGSCTools {
}
}
public static void deleteByMatId(Long matId, String bizType){
List<HGSC099> hgsc099List = listByMatId(matId,bizType);
public static void deleteByMatId(Long matId, String bizType) {
List<HGSC099> hgsc099List = listByMatId(matId, bizType);
for (int i = 0; i < hgsc099List.size(); i++) {
HGSC099 hgsc099 = hgsc099List.get(i);
DaoUtils.update(HGSC099.DELETE, hgsc099);
......@@ -1482,10 +1672,10 @@ public class HGSCTools {
* 删除文件
* @param docId 文件ID
*/
public static void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HGDS002> list = DaoBase.getInstance().query(HGDS002.QUERY,map);
public static void delectDoc(String docId) {
Map<String, Object> map = new HashMap<>();
map.put("docId", docId);
List<HGDS002> list = DaoBase.getInstance().query(HGDS002.QUERY, map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
......@@ -1519,7 +1709,6 @@ public class HGSCTools {
}
}
public static class THGSC009{
......
......@@ -46,6 +46,7 @@ public class HGSJ001 extends DaoEPBase {
public static final String FIELD_STATUS = "status"; /* 状态0.停止1.启用*/
public static final String FIELD_COMPUTE_TYPE = "computeType"; /* 计算类型*/
public static final String FIELD_COST_WEIGHT = "costWeight";
public static final String FIELD_OVERLAP_DAY = "overlapDay"; /* 前后工序重叠天数*/
public static final String COL_ID = "ID"; /* 主键id*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码 预留*/
......@@ -67,6 +68,7 @@ public class HGSJ001 extends DaoEPBase {
public static final String COL_STANDARD_NUM = "STANDARD_NUM"; /* 标准工序人数*/
public static final String COL_PRINC = "PRINC"; /* 负责人*/
public static final String COL_STATUS = "STATUS"; /* 状态0.停止1.启用*/
public static final String COL_OVERLAP_DAY = "OVERLAP_DAY"; /* 前后工序重叠天数*/
public static final String QUERY = "HGSJ001.query";
public static final String COUNT = "HGSJ001.count";
......@@ -99,6 +101,7 @@ public class HGSJ001 extends DaoEPBase {
private Integer status = 0; /* 状态0.停止1.启用*/
private Integer computeType = 0;
private BigDecimal costWeight = new BigDecimal(0.000);
private Integer overlapDay = 0; /* 前后工序重叠天数*/
/**
* initialize the metadata.
......@@ -211,6 +214,11 @@ public class HGSJ001 extends DaoEPBase {
eiColumn.setDescName("费用权重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OVERLAP_DAY);
eiColumn.setType("N");
eiColumn.setDescName("前后工序重叠天数");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -565,6 +573,15 @@ public class HGSJ001 extends DaoEPBase {
public void setCostWeight(BigDecimal costWeight) {
this.costWeight = costWeight;
}
public Integer getOverlapDay() {
return overlapDay;
}
public void setOverlapDay(Integer overlapDay) {
this.overlapDay = overlapDay;
}
/**
* get the value from Map.
*
......@@ -596,6 +613,7 @@ public class HGSJ001 extends DaoEPBase {
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setComputeType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_COMPUTE_TYPE)), computeType));
setCostWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_COST_WEIGHT)), costWeight));
setOverlapDay(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_OVERLAP_DAY)), overlapDay));
}
/**
......@@ -628,6 +646,7 @@ public class HGSJ001 extends DaoEPBase {
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_COMPUTE_TYPE, StringUtils.toString(computeType, eiMetadata.getMeta(FIELD_COMPUTE_TYPE)));
map.put(FIELD_COST_WEIGHT,StringUtils.toString(costWeight, eiMetadata.getMeta(FIELD_COST_WEIGHT)));
map.put(FIELD_OVERLAP_DAY,StringUtils.toString(overlapDay, eiMetadata.getMeta(FIELD_OVERLAP_DAY)));
return map;
}
......
......@@ -25,32 +25,13 @@
PRINC_NAME as "princName", <!-- 负责人名称 -->
STATUS as "status", <!-- 状态0.停止1.启动 -->
COMPUTE_TYPE as "computeType",
COST_WEIGHT as "costWeight" <!-- 费用权重 -->
</sql>
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
COST_WEIGHT as "costWeight", <!-- 费用权重 -->
OVERLAP_DAY as "overlapDay" <!-- 前后工序重叠天数 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
......@@ -128,101 +109,37 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sj.domain.HGSJ001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition" />
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc,ID asc
CREATED_TIME DESC, ID ASC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sj.domain.HGSJ001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGGY001 WHERE 1=1
<include refid="condition" />
<include refid="condition"/>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
PROCESS_CODE = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processName">
PROCESS_NAME = #processName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardJob">
STANDARD_JOB = #standardJob#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardDays">
STANDARD_DAYS = #standardDays#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="standardNum">
STANDARD_NUM = #standardNum#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="princ">
PRINC = #princ#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGGY001 (ID, <!-- 主键id -->
INSERT INTO ${hggpSchema}.HGGY001 (
ACCOUNT_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
......@@ -235,15 +152,16 @@
PRINC, <!-- 负责人 -->
PRINC_NAME,
STATUS, <!-- 状态0.停止1.启动 -->
COMPUTE_TYPE,
COST_WEIGHT
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #factoryCode#, #factoryName#, #processCode#, #processName#, #unit#, #standardJob#, #standardDays#, #standardNum#, #princ#, #princName#,#status#,#computeType#, #costWeight#)
COMPUTE_TYPE, COST_WEIGHT, OVERLAP_DAY
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #factoryCode#, #factoryName#, #processCode#, #processName#,
#unit#, #standardJob#, #standardDays#, #standardNum#, #princ#, #princName#,
#status#, #computeType#, #costWeight#, #overlapDay#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGGY001 WHERE
ID = #id#
DELETE FROM ${hggpSchema}.HGGY001 WHERE ID = #id#
</delete>
<!--逻辑删除-->
......@@ -254,18 +172,12 @@
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
WHERE ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGGY001
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 预留 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
......@@ -282,9 +194,9 @@
PRINC_NAME = #princName#,
STATUS = #status#, <!-- 状态0.停止1.启动 -->
COMPUTE_TYPE = #computeType#,
COST_WEIGHT = #costWeight#
WHERE
ID = #id#
COST_WEIGHT = #costWeight#,
OVERLAP_DAY = #overlapDay#
WHERE ID = #id#
</update>
<update id="updateStatus">
......@@ -294,8 +206,7 @@
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 状态0.启用1.停止 -->
WHERE
ID = #id#
WHERE ID = #id#
</update>
<select id="queryProcessCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
......
......@@ -22,8 +22,18 @@ import java.util.stream.Collectors;
*/
public class HGSJTools {
/**
*
* @author:songx
* @date:2024/9/10,11:04
*/
public static class Hgsj001 {
/**
*
* @param processCodes
* @return
*/
public static List<HGSJ001> queryByProcessCodes(List<String> processCodes){
AssertUtils.isEmpty(processCodes, "工序编码不能为空!");
Map paramMap = new HashMap();
......@@ -31,14 +41,28 @@ public class HGSJTools {
List<HGSJ001> results = DaoBase.getInstance().query(HGSJ001.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* @param processCodes
* @return
*/
public static Map<String, HGSJ001> mapByCode(List<String> processCodes) {
List<HGSJ001> results = queryByProcessCodes(processCodes);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HGSJ001::getProcessCode, item -> item));
}
}
/**
* Hgsj002a公共DAO方法定义
*/
public static class Hgsj002a {
/**
* 查询
*
* @param parentId
* @return
*/
......
......@@ -3,15 +3,12 @@
*/
package com.baosight.hggp.util;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* jdk8中新增的日期处理类,更安全、更精确也更明确
......@@ -21,7 +18,7 @@ import java.util.GregorianCalendar;
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static final DateTimeFormatter DATETIME_ALL = DateTimeFormatter.ofPattern("yyyy-MM-dd\'T\'HH:mm:ss");
public static final DateTimeFormatter DATETIME_ALL = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
public static final DateTimeFormatter TIME = DateTimeFormatter.ofPattern("HHmmss");
public static final DateTimeFormatter SHORT_YMDHMSS = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
public static final DateTimeFormatter SHORT_DATETIME = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
......@@ -39,21 +36,22 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return
*/
public static String getYesMonth(String date) {
return getYesMonth(date,DateTimeFormatter.ISO_LOCAL_DATE);
return getYesMonth(date, DateTimeFormatter.ISO_LOCAL_DATE);
}
public static String getYesMonth(String date,DateTimeFormatter dateTimeFormatter) {
public static String getYesMonth(String date, DateTimeFormatter dateTimeFormatter) {
LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(dateTimeFormatter);
}
/**
* 获取下个月的1号日期
*
* @param date 2023-09-06 or 20230906
* @return
*/
public static String getPlusYesMonth(String date,DateTimeFormatter dateTimeFormatter) {
public static String getPlusYesMonth(String date, DateTimeFormatter dateTimeFormatter) {
LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(dateTimeFormatter);
......@@ -85,14 +83,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String yesterday() {
return LocalDate.now().minusDays(1).format(DATE);
}
/**
* 获取后一天日期字符串(yyyy-MM-dd)
*
* @return
*/
public static String yesterdayEnd(String date,Integer day) {
public static String yesterdayEnd(String date, Integer day) {
return LocalDate.parse(date, SHORT_DATE).plusDays(day).format(DATE);
}
/**
* 获取日期字符串(yyyy-MM-dd)
*
......@@ -252,4 +252,32 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
.replaceAll(" ", "");
}
/**
* 转换成日期
*
* @param dateTime yyyyMMddhhmmss
* @return
*/
public static LocalDate parseToDate(String dateTime) {
return LocalDateTime.parse(dateTime, SHORT_DATETIME).toLocalDate();
}
/**
* @param startDate yyyy-MM-dd
* @param endDate yyyy-MM-dd
* @return
*/
public static boolean isBefore(String startDate, String endDate) {
return LocalDate.parse(startDate).isBefore(LocalDate.parse(endDate));
}
/**
* @param startDate yyyy-MM-dd
* @param endDate yyyy-MM-dd
* @return
*/
public static boolean isAfter(String startDate, String endDate) {
return LocalDate.parse(startDate).isAfter(LocalDate.parse(endDate));
}
}
......@@ -17,6 +17,9 @@
<!-- 工具 -->
<sqlMap resource="com/baosight/hggp/hg/dm/sql/HGDM099.xml"/>
<!-- 工艺 -->
<sqlMap resource="com/baosight/hggp/hg/sj/sql/HGSJ001.xml"/>
<!--成本-->
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB002.xml"/>
......@@ -27,6 +30,7 @@
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003.xml"/>
<!-- 库存 -->
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/>
......@@ -44,6 +48,7 @@
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC011.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013A.xml"/>
<!-- 质量 -->
<sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL002.xml"/>
......
......@@ -7,7 +7,7 @@ $(function () {
});
// 正序排产
$("#BNT_SCHEDULE_EX").on("click", scheduleEx);
$("#BNT_SCHEDULE_ASC").on("click", scheduleAsc);
// 倒序排产
$("#BNT_SCHEDULE").on("click", schedule);
......@@ -45,10 +45,10 @@ $(window).load(function () {
/**
* 正序排产
*/
function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
function scheduleAsc() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行正序排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "scheduleEx", true);
JSUtils.submitGridsData("result", "HGSC005A", "scheduleAsc", true);
}
});
}
......@@ -57,7 +57,7 @@ function schedule() {
* 倒序排产
*/
function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行倒序排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "schedule", true);
}
......
......@@ -20,8 +20,7 @@ $(function (){
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
columns: [{
field: "operator",
title: "操作",
template: function (item) {
......@@ -229,7 +228,7 @@ let save = function (btnNode) {
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSJ001", "save", true);
JSUtils.submitGridsData("result", "HGSJ001", "save", false);
btnNode.attr("disabled", false);
}
});
......
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/6
Time: 9:39
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......@@ -15,7 +8,7 @@
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<c:set var="loginName" value="<%=loginName%>"/>
<EF:EFPage title="工序设置">
<EF:EFRegion id="inqu" title="查询条件">
......@@ -48,7 +41,8 @@
</EF:EFComboColumn>
<EF:EFColumn ename="factoryName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="processCode" cname="工序编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="processName" cname="工序名称" width="120" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="processName" cname="工序名称" width="120" enable="true" readonly="true" align="center"
required="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" enable="true" readonly="false" align="center"/>
<EF:EFColumn ename="standardJob" cname="标准作业" width="100" enable="true" format="{0:N3}" editType="number"
displayType="0" sort="true" align="right" required="true"
......@@ -58,10 +52,11 @@
displayType="0" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="standardNum" cname="标准工序人数" width="100" enable="true" format="{0:N3}" editType="number"
<EF:EFColumn ename="standardNum" cname="标准工序人数" width="120" enable="true" format="{0:N3}" editType="number"
displayType="0" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="overlapDay" cname="工序重叠天数" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="computeType" cname="计算类型" width="80" enable="true" align="center" required="true">
<EF:EFCodeOption codeName="hggp.hgsj.computeType"/>
</EF:EFComboColumn>
......@@ -77,7 +72,8 @@
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<%--<EF:EFColumn ename="princ" cname="负责人" width="120" enable="true" readonly="false" align="center" required="true"/>--%>
<EF:EFComboColumn ename="status" cname="状态" width="80" enable="true" readonly="false" align="center" required="true" defaultValue="1">
<EF:EFComboColumn ename="status" cname="状态" width="80" enable="true" readonly="false" align="center"
required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false"
......
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