Commit ee2940b9 by 宋祥

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

 Conflicts:
	src/main/java/com/baosight/hggp/hg/sc/constant/HgScSqlConstant.java
	src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
parents c24be753 96e6e522
...@@ -7,14 +7,21 @@ import java.util.HashMap; ...@@ -7,14 +7,21 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 产品类型枚举
*
* @author:songx
* @date:2024/9/10,8:43
*/
public enum ProductTypeEnum { public enum ProductTypeEnum {
STRUCT(1,"构建"),
PART(2,"零件"); STRUCT(1, "构件"),
PART(2, "零件");
private Integer code;
private Integer code;
private String value;
private String value;
ProductTypeEnum(Integer code, String value) { ProductTypeEnum(Integer code, String value) {
this.code = code; this.code = code;
this.value = value; this.value = value;
...@@ -35,19 +42,19 @@ public enum ProductTypeEnum { ...@@ -35,19 +42,19 @@ public enum ProductTypeEnum {
block.setRows(rows); block.setRows(rows);
return block; return block;
} }
public static ProductTypeEnum getEnumByCode(Integer code){ public static ProductTypeEnum getEnumByCode(Integer code) {
for (ProductTypeEnum en : ProductTypeEnum.values()){ for (ProductTypeEnum en : ProductTypeEnum.values()) {
if(code.compareTo(en.code)==0){ if (code.compareTo(en.code) == 0) {
return en; return en;
} }
} }
return null; return null;
} }
public Integer getCode() { public Integer getCode() {
return code; return code;
} }
public void setCode(Integer code) { public void setCode(Integer code) {
this.code = code; this.code = code;
......
...@@ -57,6 +57,20 @@ public class CommonConstant { ...@@ -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 * @author:songx
......
...@@ -63,84 +63,86 @@ public class ServiceHGKC008A extends ServiceBase { ...@@ -63,84 +63,86 @@ public class ServiceHGKC008A extends ServiceBase {
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_RECEIVE_ID); 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 = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGKC008A hgkc008a = new HGKC008A();
hgkc008a.fromMap(resultMap);
//查询领料单
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);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 给明细赋值
* @param hgkc008a
* @param hgkc008
*/
private void setData(HGKC008A hgkc008a, HGKC008 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(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0){
hgkc008.setReceiveType(HGConstant.ReceiveType.TK);
}else{
hgkc008.setReceiveType(HGConstant.ReceiveType.ZC);
}
DaoUtils.update(HGKC008.UPDATE_RECEIVE_TYPE, hgkc008);
}
} }
return inInfo;
} }
/** /**
* 校验保存的数据 * @param inInfo
* * @return
* @param hgkc008a */
* @param hgkc008 public EiInfo save(EiInfo inInfo) {
*/ try {
private void checkSaveData(HGKC008A hgkc008a, HGKC008 hgkc008) { HGKC008A fKc008a = MapUtils.toDaoEPBase(inInfo, HGKC008A.class);
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!"); //查询领料单
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!"); HGKC008 dbKc008 = HGKCTools.HgKc008.getById(fKc008a.getReceiveId());
AssertUtils.isNull(hgkc008a.getReceiveId(), "未获取到生产领料单ID信息"); this.checkSaveData(fKc008a, dbKc008);
AssertUtils.isTrue(hgkc008a.getInvWeight().compareTo(BigDecimal.ZERO) == 0, "重量不能为0"); this.setData(fKc008a, dbKc008);
if(Objects.nonNull(hgkc008a.getId())&&hgkc008a.getId()!=0){ if (Objects.nonNull(fKc008a.getId()) && fKc008a.getId() != 0) {
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0){ DaoUtils.update(HGKC008A.UPDATE, fKc008a);
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0"); } else {
} DaoUtils.insert(HGKC008A.INSERT, fKc008a);
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0){ }
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} inInfo.setMsg("保存成功!");
} } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 给明细赋值
*
* @param hgkc008a
* @param hgkc008
*/
private void setData(HGKC008A hgkc008a, HGKC008 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 (hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0) {
hgkc008.setReceiveType(HGConstant.ReceiveType.TK);
} else {
hgkc008.setReceiveType(HGConstant.ReceiveType.ZC);
}
DaoUtils.update(HGKC008.UPDATE_RECEIVE_TYPE, hgkc008);
}
}
}
/**
* 校验保存的数据
*
* @param fKc008a
* @param dbKc008
*/
private void checkSaveData(HGKC008A fKc008a, HGKC008 dbKc008) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
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 (dbKc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0) {
AssertUtils.isTrue(fKc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
}
}
} }
} }
......
...@@ -21,7 +21,29 @@ public class HgScSqlConstant { ...@@ -21,7 +21,29 @@ public class HgScSqlConstant {
// 修改项目名称 // 修改项目名称
public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName"; public static final String UPDATE_PROJ_NAME = "HGSC001.updateProjName";
} }
/**
*
* @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 * @author:songx
......
...@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; 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.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A; import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
...@@ -125,15 +126,16 @@ public class ServiceHGSC005A extends ServiceBase { ...@@ -125,15 +126,16 @@ public class ServiceHGSC005A extends ServiceBase {
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产") @OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产")
public EiInfo scheduleEx(EiInfo inInfo) { public EiInfo scheduleAsc(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String planCode = MapUtils.getString(queryMap, "planCode"); String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode); HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005); 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); dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005); DaoUtils.update(HgScSqlConstant.HgSc005.UPDATE_IS_SCHEDULE, dbSc005);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!"); inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
...@@ -156,9 +158,9 @@ public class ServiceHGSC005A extends ServiceBase { ...@@ -156,9 +158,9 @@ public class ServiceHGSC005A extends ServiceBase {
String planCode = MapUtils.getString(queryMap, "planCode"); String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode); HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005); 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); dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005); DaoUtils.update(HgScSqlConstant.HgSc005.UPDATE_IS_SCHEDULE, dbSc005);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!"); inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
......
...@@ -2,6 +2,45 @@ ...@@ -2,6 +2,45 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC005A"> <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"> <sql id="condition">
<!--<include refid="HGXSDataAuth.authCondition"/>--> <!--<include refid="HGXSDataAuth.authCondition"/>-->
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
...@@ -122,51 +161,16 @@ ...@@ -122,51 +161,16 @@
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A"> <select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT SELECT
id as "id", <include refid="column"/>
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" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005A WHERE 1=1 FROM ${hggpSchema}.HGSC005A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
product_type asc , product_name, process_order desc product_type asc, product_code desc, process_order desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
...@@ -380,17 +384,26 @@ ...@@ -380,17 +384,26 @@
id = #id# id = #id#
</update> </update>
<update id="update_plan_date"> <update id="update_plan_date">
UPDATE ${hggpSchema}.HGSC005A UPDATE ${hggpSchema}.HGSC005A
SET SET
plan_start_date = #planStartDate#, <!-- 计划开始日期 --> plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 --> plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
updated_by = #updatedBy#, <!-- 更新人 --> updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 --> updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 --> updated_time = #updatedTime# <!-- 更新时间 -->
WHERE WHERE id = #id#
id = #id# </update>
</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" <select id="queryProcessComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap"> resultClass="java.util.HashMap">
......
...@@ -46,6 +46,7 @@ public class HGSJ001 extends DaoEPBase { ...@@ -46,6 +46,7 @@ public class HGSJ001 extends DaoEPBase {
public static final String FIELD_STATUS = "status"; /* 状态0.停止1.启用*/ public static final String FIELD_STATUS = "status"; /* 状态0.停止1.启用*/
public static final String FIELD_COMPUTE_TYPE = "computeType"; /* 计算类型*/ public static final String FIELD_COMPUTE_TYPE = "computeType"; /* 计算类型*/
public static final String FIELD_COST_WEIGHT = "costWeight"; 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_ID = "ID"; /* 主键id*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码 预留*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码 预留*/
...@@ -67,6 +68,7 @@ public class HGSJ001 extends DaoEPBase { ...@@ -67,6 +68,7 @@ public class HGSJ001 extends DaoEPBase {
public static final String COL_STANDARD_NUM = "STANDARD_NUM"; /* 标准工序人数*/ public static final String COL_STANDARD_NUM = "STANDARD_NUM"; /* 标准工序人数*/
public static final String COL_PRINC = "PRINC"; /* 负责人*/ public static final String COL_PRINC = "PRINC"; /* 负责人*/
public static final String COL_STATUS = "STATUS"; /* 状态0.停止1.启用*/ 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 QUERY = "HGSJ001.query";
public static final String COUNT = "HGSJ001.count"; public static final String COUNT = "HGSJ001.count";
...@@ -99,6 +101,7 @@ public class HGSJ001 extends DaoEPBase { ...@@ -99,6 +101,7 @@ public class HGSJ001 extends DaoEPBase {
private Integer status = 0; /* 状态0.停止1.启用*/ private Integer status = 0; /* 状态0.停止1.启用*/
private Integer computeType = 0; private Integer computeType = 0;
private BigDecimal costWeight = new BigDecimal(0.000); private BigDecimal costWeight = new BigDecimal(0.000);
private Integer overlapDay = 0; /* 前后工序重叠天数*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -210,6 +213,11 @@ public class HGSJ001 extends DaoEPBase { ...@@ -210,6 +213,11 @@ public class HGSJ001 extends DaoEPBase {
eiColumn.setFieldLength(15); eiColumn.setFieldLength(15);
eiColumn.setDescName("费用权重"); eiColumn.setDescName("费用权重");
eiMetadata.addMeta(eiColumn); 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 { ...@@ -565,6 +573,15 @@ public class HGSJ001 extends DaoEPBase {
public void setCostWeight(BigDecimal costWeight) { public void setCostWeight(BigDecimal costWeight) {
this.costWeight = costWeight; this.costWeight = costWeight;
} }
public Integer getOverlapDay() {
return overlapDay;
}
public void setOverlapDay(Integer overlapDay) {
this.overlapDay = overlapDay;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -596,6 +613,7 @@ public class HGSJ001 extends DaoEPBase { ...@@ -596,6 +613,7 @@ public class HGSJ001 extends DaoEPBase {
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status)); setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setComputeType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_COMPUTE_TYPE)), computeType)); setComputeType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_COMPUTE_TYPE)), computeType));
setCostWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_COST_WEIGHT)), costWeight)); 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 { ...@@ -628,6 +646,7 @@ public class HGSJ001 extends DaoEPBase {
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS))); 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_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_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; return map;
} }
......
...@@ -22,27 +22,51 @@ import java.util.stream.Collectors; ...@@ -22,27 +22,51 @@ import java.util.stream.Collectors;
*/ */
public class HGSJTools { public class HGSJTools {
/**
*
* @author:songx
* @date:2024/9/10,11:04
*/
public static class Hgsj001 { public static class Hgsj001 {
public static List<HGSJ001> queryByProcessCodes(List<String> processCodes){ /**
*
* @param processCodes
* @return
*/
public static List<HGSJ001> queryByProcessCodes(List<String> processCodes){
AssertUtils.isEmpty(processCodes, "工序编码不能为空!"); AssertUtils.isEmpty(processCodes, "工序编码不能为空!");
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("processCodes", processCodes); paramMap.put("processCodes", processCodes);
List<HGSJ001> results = DaoBase.getInstance().query(HGSJ001.QUERY, paramMap); List<HGSJ001> results = DaoBase.getInstance().query(HGSJ001.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results; return CollectionUtils.isEmpty(results) ? null : results;
} }
}
/**
/** * @param processCodes
* Hgsj002a公共DAO方法定义 * @return
*/ */
public static class Hgsj002a { public static Map<String, HGSJ001> mapByCode(List<String> processCodes) {
/** List<HGSJ001> results = queryByProcessCodes(processCodes);
* 查询 if (CollectionUtils.isEmpty(results)) {
* @param parentId return null;
* @return }
*/ return results.stream().collect(Collectors.toMap(HGSJ001::getProcessCode, item -> item));
public static List<HGSJ002A> list(Long parentId){ }
}
/**
* Hgsj002a公共DAO方法定义
*/
public static class Hgsj002a {
/**
* 查询
*
* @param parentId
* @return
*/
public static List<HGSJ002A> list(Long parentId){
AssertUtils.isNull(parentId, "parentId不能为空"); AssertUtils.isNull(parentId, "parentId不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put(HGSJ002A.FIELD_PAREND_ID, parentId); queryMap.put(HGSJ002A.FIELD_PAREND_ID, parentId);
......
...@@ -3,15 +3,12 @@ ...@@ -3,15 +3,12 @@
*/ */
package com.baosight.hggp.util; package com.baosight.hggp.util;
import java.text.SimpleDateFormat;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import java.util.GregorianCalendar;
/** /**
* jdk8中新增的日期处理类,更安全、更精确也更明确 * jdk8中新增的日期处理类,更安全、更精确也更明确
...@@ -21,7 +18,7 @@ import java.util.GregorianCalendar; ...@@ -21,7 +18,7 @@ import java.util.GregorianCalendar;
*/ */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils { 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 TIME = DateTimeFormatter.ofPattern("HHmmss");
public static final DateTimeFormatter SHORT_YMDHMSS = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"); public static final DateTimeFormatter SHORT_YMDHMSS = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
public static final DateTimeFormatter SHORT_DATETIME = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); public static final DateTimeFormatter SHORT_DATETIME = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
...@@ -39,26 +36,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -39,26 +36,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @return * @return
*/ */
public static String getYesMonth(String date) { 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); LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth()); endLocalDate = endLocalDate.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(dateTimeFormatter); return endLocalDate.format(dateTimeFormatter);
} }
/** /**
* 获取下个月的1号日期 * 获取下个月的1号日期
* *
* @param date 2023-09-06 or 20230906 * @param date 2023-09-06 or 20230906
* @return * @return
*/ */
public static String getPlusYesMonth(String date,DateTimeFormatter dateTimeFormatter) { public static String getPlusYesMonth(String date, DateTimeFormatter dateTimeFormatter) {
LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter); LocalDate endLocalDate = LocalDate.parse(date, dateTimeFormatter);
endLocalDate = endLocalDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth()); endLocalDate = endLocalDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(dateTimeFormatter); return endLocalDate.format(dateTimeFormatter);
} }
/** /**
* 获取当前的日期字符串(yyyy-MM) * 获取当前的日期字符串(yyyy-MM)
* *
...@@ -76,7 +74,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -76,7 +74,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String date() { public static String date() {
return date(null); return date(null);
} }
/** /**
* 获取前一天日期字符串(yyyy-MM-dd) * 获取前一天日期字符串(yyyy-MM-dd)
* *
...@@ -85,14 +83,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -85,14 +83,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String yesterday() { public static String yesterday() {
return LocalDate.now().minusDays(1).format(DATE); return LocalDate.now().minusDays(1).format(DATE);
} }
/** /**
* 获取后一天日期字符串(yyyy-MM-dd) * 获取后一天日期字符串(yyyy-MM-dd)
* *
* @return * @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); return LocalDate.parse(date, SHORT_DATE).plusDays(day).format(DATE);
} }
/** /**
* 获取日期字符串(yyyy-MM-dd) * 获取日期字符串(yyyy-MM-dd)
* *
...@@ -252,4 +252,32 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ...@@ -252,4 +252,32 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
.replaceAll(" ", ""); .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 @@ ...@@ -17,6 +17,9 @@
<!-- 工具 --> <!-- 工具 -->
<sqlMap resource="com/baosight/hggp/hg/dm/sql/HGDM099.xml"/> <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/HGCB001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB002.xml"/> <sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB002.xml"/>
...@@ -27,6 +30,7 @@ ...@@ -27,6 +30,7 @@
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG001.xml"/> <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/HGCG002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003.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/HGKC001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/>
...@@ -44,6 +48,7 @@ ...@@ -44,6 +48,7 @@
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC011.xml"/> <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/HGKC013.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013A.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/HGZL001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL002.xml"/> <sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL002.xml"/>
......
...@@ -7,7 +7,7 @@ $(function () { ...@@ -7,7 +7,7 @@ $(function () {
}); });
// 正序排产 // 正序排产
$("#BNT_SCHEDULE_EX").on("click", scheduleEx); $("#BNT_SCHEDULE_ASC").on("click", scheduleAsc);
// 倒序排产 // 倒序排产
$("#BNT_SCHEDULE").on("click", schedule); $("#BNT_SCHEDULE").on("click", schedule);
...@@ -45,10 +45,10 @@ $(window).load(function () { ...@@ -45,10 +45,10 @@ $(window).load(function () {
/** /**
* 正序排产 * 正序排产
*/ */
function schedule() { function scheduleAsc() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", { JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行正序排产? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "scheduleEx", true); JSUtils.submitGridsData("result", "HGSC005A", "scheduleAsc", true);
} }
}); });
} }
...@@ -57,7 +57,7 @@ function schedule() { ...@@ -57,7 +57,7 @@ function schedule() {
* 倒序排产 * 倒序排产
*/ */
function schedule() { function schedule() {
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", { JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行倒序排产? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "schedule", true); JSUtils.submitGridsData("result", "HGSC005A", "schedule", true);
} }
......
...@@ -20,8 +20,7 @@ $(function (){ ...@@ -20,8 +20,7 @@ $(function (){
pageSize: 10, pageSize: 10,
pageSizes: [10, 20, 50, 100], pageSizes: [10, 20, 50, 100],
}, },
columns: [ columns: [{
{
field: "operator", field: "operator",
title: "操作", title: "操作",
template: function (item) { template: function (item) {
...@@ -229,7 +228,7 @@ let save = function (btnNode) { ...@@ -229,7 +228,7 @@ let save = function (btnNode) {
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSJ001", "save", true); JSUtils.submitGridsData("result", "HGSJ001", "save", false);
btnNode.attr("disabled", false); btnNode.attr("disabled", false);
} }
}); });
...@@ -274,4 +273,4 @@ function loadChange(grid,e,field) { ...@@ -274,4 +273,4 @@ function loadChange(grid,e,field) {
var td = tr.children("td:eq("+index+")"); var td = tr.children("td:eq("+index+")");
// 触发 td.click 事件, // 触发 td.click 事件,
td.trigger("click"); td.trigger("click");
} }
\ No newline at end of file
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