Commit 3f6be941 by liuyang

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

parents cd84a3e2 46b6a0c5
...@@ -36,6 +36,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -36,6 +36,7 @@ public class HGCG001A extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PLAN_DATE = "planDate"; /* 计划日期*/ public static final String FIELD_PLAN_DATE = "planDate"; /* 计划日期*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/ public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
public static final String FIELD_PLAN_LINE_NO = "planLineNo"; /* 计划单行号*/
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/ public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/ public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/ public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
...@@ -122,6 +123,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -122,6 +123,7 @@ public class HGCG001A extends DaoEPBase {
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String planDate = " "; /* 计划日期*/ private String planDate = " "; /* 计划日期*/
private String planNo = " "; /* 计划单号*/ private String planNo = " "; /* 计划单号*/
private String planLineNo = " "; /* 计划单行号*/
private String inventType = " "; /* 存货类型*/ private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
...@@ -216,7 +218,11 @@ public class HGCG001A extends DaoEPBase { ...@@ -216,7 +218,11 @@ public class HGCG001A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PLAN_NO); eiColumn = new EiColumn(FIELD_PLAN_NO);
eiColumn.setDescName("计划单号"); eiColumn.setDescName("计划单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_LINE_NO);
eiColumn.setDescName("计划单行号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE); eiColumn = new EiColumn(FIELD_INVENT_TYPE);
eiColumn.setDescName("存货类型"); eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -984,6 +990,14 @@ public class HGCG001A extends DaoEPBase { ...@@ -984,6 +990,14 @@ public class HGCG001A extends DaoEPBase {
this.calculationMethod = calculationMethod; this.calculationMethod = calculationMethod;
} }
public String getPlanLineNo() {
return planLineNo;
}
public void setPlanLineNo(String planLineNo) {
this.planLineNo = planLineNo;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1006,6 +1020,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1006,6 +1020,7 @@ public class HGCG001A extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setPlanDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_DATE)), planDate)); setPlanDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_DATE)), planDate));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo)); setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
setPlanLineNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_LINE_NO)), planLineNo));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
...@@ -1059,6 +1074,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1059,6 +1074,7 @@ public class HGCG001A extends DaoEPBase {
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME))); map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PLAN_DATE, StringUtils.toString(planDate, eiMetadata.getMeta(FIELD_PLAN_DATE))); map.put(FIELD_PLAN_DATE, StringUtils.toString(planDate, eiMetadata.getMeta(FIELD_PLAN_DATE)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO))); map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
map.put(FIELD_PLAN_LINE_NO, StringUtils.toString(planLineNo, eiMetadata.getMeta(FIELD_PLAN_LINE_NO)));
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE))); map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE))); map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME))); map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
......
...@@ -22,6 +22,7 @@ import com.baosight.hggp.util.contants.ACConstants; ...@@ -22,6 +22,7 @@ import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -121,25 +122,33 @@ public class ServiceHGCG001A extends ServiceBase { ...@@ -121,25 +122,33 @@ public class ServiceHGCG001A extends ServiceBase {
AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurWeight(), String.format("计划明细[%s]采购重量必须大于0", fCg001a.getInventCode())); AssertUtils.isGe(BigDecimal.ZERO, fCg001a.getPurWeight(), String.format("计划明细[%s]采购重量必须大于0", fCg001a.getInventCode()));
} }
} }
/** /**
* 数据保存 * 数据保存
* *
* @param fCg001s * @param fCg001s
*/ */
private void saveData(List<HGCG001A> fCg001s,HGCG001 cg001) { private void saveData(List<HGCG001A> fCg001s, HGCG001 dbCg001) {
for (HGCG001A fCg001a : fCg001s) { for (HGCG001A fCg001a : fCg001s) {
fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP)); fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP));
if(fCg001a.getId() == null || fCg001a.getId() == 0){ if (fCg001a.getId() == null || fCg001a.getId() == 0) {
BeanUtils.copyProperties(cg001,fCg001a,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime", fCg001a.setPlanDate(dbCg001.getPlanDate());
"inventType","inventTypeDetail","inventCode","inventName","spec","material","unit","length","width","thick","purQty","purUnitWeight","purWeight"); fCg001a.setPlanNo(dbCg001.getPlanNo());
fCg001a.setPlanLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_LINE_NO,
new String[]{dbCg001.getPlanNo()}));
fCg001a.setCompanyCode(dbCg001.getCompanyCode());
fCg001a.setCompanyName(dbCg001.getCompanyName());
fCg001a.setProjCode(dbCg001.getProjCode());
fCg001a.setProjName(dbCg001.getProjName());
fCg001a.setStatus(HGConstant.CgPlanStatus.S_0);
fCg001a.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG001A.INSERT, fCg001a); DaoUtils.insert(HGCG001A.INSERT, fCg001a);
}else{ } else {
DaoUtils.update(HGCG001A.UPDATE, fCg001a); DaoUtils.update(HGCG001A.UPDATE, fCg001a);
} }
} }
//修改主表数量 //修改主表数量
updateCg001Pur(cg001); updateCg001Pur(dbCg001);
} }
private void updateCg001Pur(HGCG001 cg001) { private void updateCg001Pur(HGCG001 cg001) {
......
...@@ -2,11 +2,51 @@ ...@@ -2,11 +2,51 @@
<!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="HGCG001A"> <sqlMap namespace="HGCG001A">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PLAN_DATE as "planDate", <!-- 计划日期 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
PLAN_LINE_NO as "planLineNo", <!-- 计划单号 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
PLAN_QTY as "planQty", <!-- 计划数量 -->
PLAN_UNIT_WEIGHT as "planUnitWeight", <!-- 计划单重 -->
PLAN_WEIGHT as "planWeight", <!-- 计划重量 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
REMARKS as "remarks", <!-- 备注 -->
PROJ_CODE as "projCode",
PROJ_NAME as "projName",
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRIMARY_ID as "primaryId" <!-- 主表id -->
</sql>
<sql id="condition"> <sql id="condition">
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id"> <include refid="idCondition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
...@@ -121,6 +161,12 @@ ...@@ -121,6 +161,12 @@
<isNotEmpty prepend=" AND " property="ids"> <isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate> ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planLineNo">
PLAN_LINE_NO = #planLineNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planLineNos">
PLAN_LINE_NO IN <iterate open="(" close=")" conjunction="," property="planLineNos">#planLineNos[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="conditionByContract"> <sql id="conditionByContract">
...@@ -245,72 +291,29 @@ ...@@ -245,72 +291,29 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <sql id="orderBy">
<sql id="updateRevise"> <dynamic prepend="ORDER BY">
UPDATED_BY = #updatedBy#, <isNotEmpty property="orderBy">
UPDATED_NAME = #updatedName#, $orderBy$
UPDATED_TIME = #updatedTime# </isNotEmpty>
</sql> <isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A">
resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A"> SELECT
SELECT <include refid="column"/>
ID as "id", FROM ${hggpSchema}.HGCG001A WHERE 1=1
ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> <include refid="condition"/>
DEP_CODE as "depCode", <!-- 部门编码 --> <include refid="orderBy"/>
CREATED_BY as "createdBy", <!-- 记录创建者 --> </select>
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PLAN_DATE as "planDate", <!-- 计划日期 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
PLAN_QTY as "planQty", <!-- 计划数量 -->
PLAN_UNIT_WEIGHT as "planUnitWeight", <!-- 计划单重 -->
PLAN_WEIGHT as "planWeight", <!-- 计划重量 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
REMARKS as "remarks", <!-- 备注 -->
PROJ_CODE as "projCode",
PROJ_NAME as "projName",
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRIMARY_ID as "primaryId" <!-- 主表id -->
FROM ${hggpSchema}.HGCG001A WHERE 1=1
<include refid="condition" />
<include refid="idCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCG001A WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGCG001A WHERE 1=1
<include refid="condition" /> <include refid="condition"/>
</select> </select>
<select id="queryByContract" resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A"> <select id="queryByContract" resultClass="com.baosight.hggp.hg.cg.domain.HGCG001A">
SELECT SELECT
...@@ -365,93 +368,83 @@ ...@@ -365,93 +368,83 @@
</dynamic> </dynamic>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGCG001A (ID, INSERT INTO ${hggpSchema}.HGCG001A (
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 --> DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 --> CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 --> CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 --> CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 --> DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
UPDATED_NAME, <!-- 记录修改名称 --> COMPANY_CODE, <!-- 公司编码 -->
UPDATED_TIME, <!-- 记录修改时间 --> COMPANY_NAME, <!-- 公司名称 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 --> PLAN_DATE, <!-- 计划日期 -->
COMPANY_CODE, <!-- 公司编码 --> PLAN_NO, <!-- 计划单号 -->
COMPANY_NAME, <!-- 公司名称 --> PLAN_LINE_NO, <!-- 计划单行号 -->
PLAN_DATE, <!-- 计划日期 --> INVENT_TYPE, <!-- 存货类型 -->
PLAN_NO, <!-- 计划单号 --> INVENT_CODE, <!-- 存货编码 -->
INVENT_TYPE, <!-- 存货类型 --> INVENT_NAME, <!-- 存货名称 -->
INVENT_CODE, <!-- 存货编码 --> SPEC, <!-- 规格 -->
INVENT_NAME, <!-- 存货名称 --> MATERIAL, <!-- 材质 -->
SPEC, <!-- 规格 --> UNIT, <!-- 单位 -->
MATERIAL, <!-- 材质 --> LENGTH, <!-- 长度 -->
UNIT, <!-- 单位 --> WIDTH, <!-- 宽度 -->
LENGTH, <!-- 长度 --> THICK, <!-- 厚度 -->
WIDTH, <!-- 宽度 --> PLAN_QTY, <!-- 计划数量 -->
THICK, <!-- 厚度 --> PLAN_UNIT_WEIGHT, <!-- 计划单重 -->
PLAN_QTY, <!-- 计划数量 --> PLAN_WEIGHT, <!-- 计划重量 -->
PLAN_UNIT_WEIGHT, <!-- 计划单重 --> PUR_QTY, <!-- 采购数量 -->
PLAN_WEIGHT, <!-- 计划重量 --> PUR_UNIT_WEIGHT, <!-- 采购单重 -->
PUR_QTY, <!-- 采购数量 --> PUR_WEIGHT, <!-- 采购重量 -->
PUR_UNIT_WEIGHT, <!-- 采购单重 --> MATERIAL_PLAN_ID, <!-- 材料计划id -->
PUR_WEIGHT, <!-- 采购重量 --> INVENT_TYPE_DETAIL, <!-- 存货类型大类 -->
MATERIAL_PLAN_ID, <!-- 材料计划id --> STATUS,
INVENT_TYPE_DETAIL, <!-- 存货类型大类 --> PRIMARY_ID, <!-- 主表id -->
STATUS, PROJ_CODE, <!-- 项目编码 -->
PRIMARY_ID, <!-- 主表id --> PROJ_NAME, <!-- 项目名称 -->
PROJ_CODE, <!-- 项目编码 --> REMARKS
PROJ_NAME, <!-- 项目名称 --> ) VALUES (
REMARKS #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
) #deleteFlag#, #companyCode#, #companyName#, #planDate#, #planNo#, #planLineNo#, #inventType#, #inventCode#,
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #planDate#, #planNo#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #planQty#, #planUnitWeight#, #planWeight#, #purQty#, #purUnitWeight#, #purWeight#, #materialPlanId#, #inventTypeDetail#,#status#, #primaryId#,#projCode#,#projName#, #remarks#) #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #planQty#, #planUnitWeight#, #planWeight#,
</insert> #purQty#, #purUnitWeight#, #purWeight#, #materialPlanId#, #inventTypeDetail#,#status#,
#primaryId#,#projCode#,#projName#, #remarks#)
</insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hggpSchema}.HGCG001A WHERE DELETE FROM ${hggpSchema}.HGCG001A WHERE ID = #id#
ID = #id# </delete>
</delete>
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCG001A UPDATE ${hggpSchema}.HGCG001A
SET SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 --> PLAN_DATE = #planDate#, <!-- 计划日期 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 --> INVENT_TYPE = #inventType#, <!-- 存货类型 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 --> INVENT_CODE = #inventCode#, <!-- 存货编码 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 --> INVENT_NAME = #inventName#, <!-- 存货名称 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> SPEC = #spec#, <!-- 规格 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 --> MATERIAL = #material#, <!-- 材质 -->
DELETE_FLAG = #deleteFlag#, <!-- 0-未删除,1-已删除 --> UNIT = #unit#, <!-- 单位 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> LENGTH = #length#, <!-- 长度 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> WIDTH = #width#, <!-- 宽度 -->
PLAN_DATE = #planDate#, <!-- 计划日期 --> THICK = #thick#, <!-- 厚度 -->
PLAN_NO = #planNo#, <!-- 计划单号 --> PLAN_QTY = #planQty#, <!-- 计划数量 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 --> PLAN_UNIT_WEIGHT = #planUnitWeight#, <!-- 计划单重 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 --> PLAN_WEIGHT = #planWeight#, <!-- 计划重量 -->
INVENT_NAME = #inventName#, <!-- 存货名称 --> PUR_QTY = #purQty#, <!-- 采购数量 -->
SPEC = #spec#, <!-- 规格 --> PUR_UNIT_WEIGHT = #purUnitWeight#, <!-- 采购单重 -->
MATERIAL = #material#, <!-- 材质 --> PUR_WEIGHT = #purWeight#, <!-- 采购重量 -->
UNIT = #unit#, <!-- 单位 --> MATERIAL_PLAN_ID = #materialPlanId#, <!-- 材料计划id -->
LENGTH = #length#, <!-- 长度 --> INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
WIDTH = #width#, <!-- 宽度 --> STATUS = #status#,
THICK = #thick#, <!-- 厚度 --> REMARKS = #remarks#,
PLAN_QTY = #planQty#, <!-- 计划数量 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PLAN_UNIT_WEIGHT = #planUnitWeight#, <!-- 计划单重 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
PLAN_WEIGHT = #planWeight#, <!-- 计划重量 --> <include refid="SqlBase.updateRevise"/>
PUR_QTY = #purQty#, <!-- 采购数量 --> WHERE ID = #id#
PUR_UNIT_WEIGHT = #purUnitWeight#, <!-- 采购单重 --> </update>
PUR_WEIGHT = #purWeight#, <!-- 采购重量 -->
MATERIAL_PLAN_ID = #materialPlanId#, <!-- 材料计划id -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
STATUS = #status#,
REMARKS = #remarks#,
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
PRIMARY_ID = #primaryId# <!-- 主表id -->
WHERE
ID = #id#
</update>
<!-- 行锁 --> <!-- 行锁 -->
<update id="lock"> <update id="lock">
...@@ -466,15 +459,17 @@ ...@@ -466,15 +459,17 @@
UPDATE ${hggpSchema}.HGCG001A UPDATE ${hggpSchema}.HGCG001A
SET SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 --> STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/> <include refid="SqlBase.updateRevise"/>
WHERE PLAN_NO = #planNo# WHERE PLAN_NO = #planNo#
</update> </update>
<!-- 修改状态信息 --> <!-- 修改状态信息 -->
<update id="updateStatusById"> <update id="updateStatusById">
UPDATE ${hggpSchema}.HGCG001A UPDATE ${hggpSchema}.HGCG001A
SET SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 --> STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/> <include refid="SqlBase.updateRevise"/>
WHERE ID = #id# WHERE ID = #id#
</update> </update>
</sqlMap> </sqlMap>
...@@ -99,6 +99,8 @@ public class HGConstant { ...@@ -99,6 +99,8 @@ public class HGConstant {
public static final String APPLY_CODE = "APPLY_CODE"; public static final String APPLY_CODE = "APPLY_CODE";
// 采购计划号 // 采购计划号
public static final String CG_PLAN_NO = "CG_PLAN_NO"; public static final String CG_PLAN_NO = "CG_PLAN_NO";
// 采购计划行号
public static final String CG_PLAN_LINE_NO = "CG_PLAN_LINE_NO";
// 采购合同号 // 采购合同号
public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO"; public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO";
// 采购合同行号 // 采购合同行号
......
...@@ -58,4 +58,21 @@ public class HgScSqlConstant { ...@@ -58,4 +58,21 @@ public class HgScSqlConstant {
//app 查询生产任务数量 //app 查询生产任务数量
public static final String COUNT_APP = "HGSC007.countApp"; public static final String COUNT_APP = "HGSC007.countApp";
} }
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:43
*/
public static class HgSc007B {
// 去重查询
public static final String QUERY_DISTINCT = "HGSC007B.queryDistinct";
// 批量新增
public static final String BATCH_INSERT = "HGSC007B.batchInsert";
// 根据订单清除
public static final String DELETE_BY_ORDER = "HGSC007B.deleteByOrder";
}
} }
package com.baosight.hggp.hg.sc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgsc007b.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-09-14 14:26:37 create
*/
public class HGSC007B extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id";
public static final String FIELD_account_code = "accountCode"; /* 帐套*/
public static final String FIELD_dep_code = "depCode"; /* 部门编码*/
public static final String FIELD_dep_name = "depName"; /* 部门名称*/
public static final String FIELD_created_by = "createdBy"; /* 创建人*/
public static final String FIELD_created_name = "createdName"; /* 创建人名称*/
public static final String FIELD_created_time = "createdTime"; /* 创建时间*/
public static final String FIELD_updated_by = "updatedBy"; /* 更新人*/
public static final String FIELD_updated_name = "updatedName"; /* 修改人名称*/
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String FIELD_delete_flag = "deleteFlag"; /* 0=未删除,1=已删除*/
public static final String FIELD_order_id = "orderId"; /* 生产订单ID*/
public static final String FIELD_order_detail_id = "orderDetailId"; /* 生产订单明细ID*/
public static final String FIELD_task_code = "taskCode"; /* 任务编码*/
public static final String FIELD_factory_code = "factoryCode"; /* 工厂编号*/
public static final String FIELD_factory_name = "factoryName"; /* 工厂名称*/
public static final String FIELD_group_code = "groupCode"; /* 工作组编号*/
public static final String FIELD_group_name = "groupName"; /* 工作组名称*/
public static final String FIELD_user_id = "userId"; /* 用户ID*/
public static final String FIELD_user_name = "userName"; /* 用户姓名*/
public static final String COL_id = "id";
public static final String COL_account_code = "account_code"; /* 帐套*/
public static final String COL_dep_code = "dep_code"; /* 部门编码*/
public static final String COL_dep_name = "dep_name"; /* 部门名称*/
public static final String COL_created_by = "created_by"; /* 创建人*/
public static final String COL_created_name = "created_name"; /* 创建人名称*/
public static final String COL_created_time = "created_time"; /* 创建时间*/
public static final String COL_updated_by = "updated_by"; /* 更新人*/
public static final String COL_updated_name = "updated_name"; /* 修改人名称*/
public static final String COL_updated_time = "updated_time"; /* 更新时间*/
public static final String COL_delete_flag = "delete_flag"; /* 0=未删除,1=已删除*/
public static final String COL_order_id = "order_id"; /* 生产订单ID*/
public static final String COL_order_detail_id = "order_detail_id"; /* 生产订单明细ID*/
public static final String COL_task_code = "task_code"; /* 任务编码*/
public static final String COL_factory_code = "factory_code"; /* 工厂编号*/
public static final String COL_factory_name = "factory_name"; /* 工厂名称*/
public static final String COL_group_code = "group_code"; /* 工作组编号*/
public static final String COL_group_name = "group_name"; /* 工作组名称*/
public static final String COL_user_id = "user_id"; /* 用户ID*/
public static final String COL_user_name = "user_name"; /* 用户姓名*/
public static final String QUERY = "HGSC007B.query";
public static final String COUNT = "HGSC007B.count";
public static final String INSERT = "HGSC007B.insert";
public static final String UPDATE = "HGSC007B.update";
public static final String DELETE = "HGSC007B.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 帐套*/
private String depCode = " "; /* 部门编码*/
private String depName = " "; /* 部门名称*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag; /* 0=未删除,1=已删除*/
private Long orderId = new Long(0); /* 生产订单ID*/
private Long orderDetailId = new Long(0); /* 生产订单明细ID*/
private String taskCode = " "; /* 任务编码*/
private String factoryCode = " "; /* 工厂编号*/
private String factoryName = " "; /* 工厂名称*/
private String groupCode = " "; /* 工作组编号*/
private String groupName = " "; /* 工作组名称*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户姓名*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_id);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_account_code);
eiColumn.setDescName("帐套");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_dep_code);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_dep_name);
eiColumn.setDescName("部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_by);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_name);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_time);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_by);
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_name);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_time);
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_delete_flag);
eiColumn.setDescName("0=未删除,1=已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_order_id);
eiColumn.setDescName("生产订单ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_order_detail_id);
eiColumn.setDescName("生产订单明细ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_task_code);
eiColumn.setDescName("任务编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_factory_code);
eiColumn.setDescName("工厂编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_factory_name);
eiColumn.setDescName("工厂名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_group_code);
eiColumn.setDescName("工作组编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_group_name);
eiColumn.setDescName("工作组名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_user_id);
eiColumn.setDescName("用户ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_user_name);
eiColumn.setDescName("用户姓名");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGSC007B() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 帐套.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 帐套.
*
* @param accountCode - 帐套
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the depName - 部门名称.
* @return the depName
*/
public String getDepName() {
return this.depName;
}
/**
* set the depName - 部门名称.
*
* @param depName - 部门名称
*/
public void setDepName(String depName) {
this.depName = depName;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 修改人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改人名称.
*
* @param updatedName - 修改人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0=未删除,1=已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0=未删除,1=已删除.
*
* @param deleteFlag - 0=未删除,1=已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the orderId - 生产订单ID.
* @return the orderId
*/
public Long getOrderId() {
return this.orderId;
}
/**
* set the orderId - 生产订单ID.
*
* @param orderId - 生产订单ID
*/
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
/**
* get the orderDetailId - 生产订单明细ID.
* @return the orderDetailId
*/
public Long getOrderDetailId() {
return this.orderDetailId;
}
/**
* set the orderDetailId - 生产订单明细ID.
*
* @param orderDetailId - 生产订单明细ID
*/
public void setOrderDetailId(Long orderDetailId) {
this.orderDetailId = orderDetailId;
}
/**
* get the taskCode - 任务编码.
* @return the taskCode
*/
public String getTaskCode() {
return this.taskCode;
}
/**
* set the taskCode - 任务编码.
*
* @param taskCode - 任务编码
*/
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
/**
* get the factoryCode - 工厂编号.
* @return the factoryCode
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* set the factoryCode - 工厂编号.
*
* @param factoryCode - 工厂编号
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* get the factoryName - 工厂名称.
* @return the factoryName
*/
public String getFactoryName() {
return this.factoryName;
}
/**
* set the factoryName - 工厂名称.
*
* @param factoryName - 工厂名称
*/
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
/**
* get the groupCode - 工作组编号.
* @return the groupCode
*/
public String getGroupCode() {
return this.groupCode;
}
/**
* set the groupCode - 工作组编号.
*
* @param groupCode - 工作组编号
*/
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
/**
* get the groupName - 工作组名称.
* @return the groupName
*/
public String getGroupName() {
return this.groupName;
}
/**
* set the groupName - 工作组名称.
*
* @param groupName - 工作组名称
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* get the userId - 用户ID.
* @return the userId
*/
public String getUserId() {
return this.userId;
}
/**
* set the userId - 用户ID.
*
* @param userId - 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* get the userName - 用户姓名.
* @return the userName
*/
public String getUserName() {
return this.userName;
}
/**
* set the userName - 用户姓名.
*
* @param userName - 用户姓名
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_id)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_account_code)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_code)), depCode));
setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_name)), depName));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_by)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_name)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_time)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_by)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_name)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_time)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_delete_flag)), deleteFlag));
setOrderId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_order_id)), orderId));
setOrderDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_order_detail_id)), orderDetailId));
setTaskCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_task_code)), taskCode));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_factory_code)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_factory_name)), factoryName));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_user_id)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_user_name)), userName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_id, StringUtils.toString(id, eiMetadata.getMeta(FIELD_id)));
map.put(FIELD_account_code, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_account_code)));
map.put(FIELD_dep_code, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_dep_code)));
map.put(FIELD_dep_name, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_dep_name)));
map.put(FIELD_created_by, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_created_by)));
map.put(FIELD_created_name, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_created_name)));
map.put(FIELD_created_time, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_created_time)));
map.put(FIELD_updated_by, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_updated_by)));
map.put(FIELD_updated_name, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_updated_name)));
map.put(FIELD_updated_time, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_updated_time)));
map.put(FIELD_delete_flag, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_delete_flag)));
map.put(FIELD_order_id, StringUtils.toString(orderId, eiMetadata.getMeta(FIELD_order_id)));
map.put(FIELD_order_detail_id, StringUtils.toString(orderDetailId, eiMetadata.getMeta(FIELD_order_detail_id)));
map.put(FIELD_task_code, StringUtils.toString(taskCode, eiMetadata.getMeta(FIELD_task_code)));
map.put(FIELD_factory_code, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_factory_code)));
map.put(FIELD_factory_name, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_factory_name)));
map.put(FIELD_group_code, StringUtils.toString(groupCode, eiMetadata.getMeta(FIELD_group_code)));
map.put(FIELD_group_name, StringUtils.toString(groupName, eiMetadata.getMeta(FIELD_group_name)));
map.put(FIELD_user_id, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_user_id)));
map.put(FIELD_user_name, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_user_name)));
return map;
}
}
...@@ -7,8 +7,12 @@ import com.baosight.hggp.core.dao.DaoBase; ...@@ -7,8 +7,12 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils; import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -115,6 +119,8 @@ public class ServiceHGSC006A extends ServiceBase { ...@@ -115,6 +119,8 @@ public class ServiceHGSC006A extends ServiceBase {
hgsc007.setFactoryCode(factoryCode); hgsc007.setFactoryCode(factoryCode);
hgsc007.setFactoryName(factoryName); hgsc007.setFactoryName(factoryName);
DaoUtils.insert(HGSC007.INSERT, hgsc007); DaoUtils.insert(HGSC007.INSERT, hgsc007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(hgsc007);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!"); inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!");
......
...@@ -4,17 +4,26 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,17 +4,26 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum; import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.ProductTypeEnum; import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -24,11 +33,15 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -24,11 +33,15 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.baosight.hggp.common.AssignStatusEnum.*;
/** /**
* 拆单派工 * 拆单派工
* *
...@@ -217,6 +230,8 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -217,6 +230,8 @@ public class ServiceHGSC006B extends ServiceBase {
add007.setLength(hgpz005.getLength()); add007.setLength(hgpz005.getLength());
} }
DaoUtils.insert(HGSC007.INSERT, add007); DaoUtils.insert(HGSC007.INSERT, add007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(add007);
} }
private void cleanBaseInfo(HGSC007 hgsc007){ private void cleanBaseInfo(HGSC007 hgsc007){
...@@ -260,9 +275,10 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -260,9 +275,10 @@ public class ServiceHGSC006B extends ServiceBase {
sc007.setUnfinishWeight(sc007.getTotalWeight()); sc007.setUnfinishWeight(sc007.getTotalWeight());
DaoUtils.update(HGSC007.UPDATE, sc007); DaoUtils.update(HGSC007.UPDATE, sc007);
// 更新派工人员
HgScUtils.HgSc007B.modifyGroupUser(hgsc007);
} }
/** /**
* 删除操作. * 删除操作.
* *
...@@ -286,6 +302,8 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -286,6 +302,8 @@ public class ServiceHGSC006B extends ServiceBase {
HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity()); HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity());
// 删除子单 // 删除子单
DaoUtils.update(HGSC007.DELETE, hgsc007); DaoUtils.update(HGSC007.DELETE, hgsc007);
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, hgsc007);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
// 刷新主订单信息 // 刷新主订单信息
...@@ -333,11 +351,11 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -333,11 +351,11 @@ public class ServiceHGSC006B extends ServiceBase {
// 0.未派工,1.部分派工,2.全部派工 // 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum orderDetailAssignStatus ; AssignStatusEnum orderDetailAssignStatus ;
if (jhNum - totalNum==0) { if (jhNum - totalNum==0) {
orderDetailAssignStatus = ASSIGNED; orderDetailAssignStatus = AssignStatusEnum.ASSIGNED;
} else if (totalNum>0) { } else if (totalNum>0) {
orderDetailAssignStatus = PARTIAL_ASSIGN; orderDetailAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} else { } else {
orderDetailAssignStatus = UNASSIGN; orderDetailAssignStatus = AssignStatusEnum.UNASSIGN;
} }
updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode()); updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode());
DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap); DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap);
...@@ -358,19 +376,19 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -358,19 +376,19 @@ public class ServiceHGSC006B extends ServiceBase {
switch (orderDetailAssignStatus){ switch (orderDetailAssignStatus){
case UNASSIGN: case UNASSIGN:
if(unassignQuantity == totalQuantity){ if(unassignQuantity == totalQuantity){
orderAssignStatus = UNASSIGN; orderAssignStatus = AssignStatusEnum.UNASSIGN;
}else{ }else{
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} }
break; break;
case PARTIAL_ASSIGN: case PARTIAL_ASSIGN:
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
break; break;
case ASSIGNED: case ASSIGNED:
if(assignQuantity == totalQuantity){ if(assignQuantity == totalQuantity){
orderAssignStatus = ASSIGNED; orderAssignStatus = AssignStatusEnum.ASSIGNED;
}else{ }else{
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} }
break; break;
default: default:
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* 派工人员信息
*
* @author:songx
* @date:2024/9/14,14:30
*/
public class ServiceHGSC007B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007B().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 去重查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo queryDistinct(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
...@@ -268,6 +268,8 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -268,6 +268,8 @@ public class ServiceHGSC009A extends ServiceBase {
cg001A.setPlanWeight(hgsc009A.getGrossAmount()); cg001A.setPlanWeight(hgsc009A.getGrossAmount());
cg001A.setPlanQty(hgsc009A.getQuantity()); cg001A.setPlanQty(hgsc009A.getQuantity());
cg001A.setPlanNo(hgcg001.getPlanNo()); cg001A.setPlanNo(hgcg001.getPlanNo());
cg001A.setPlanLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_LINE_NO,
new String[]{hgcg001.getPlanNo()}));
cg001A.setUnit(finalPz005Map.get(hgsc009A.getInventCode()).getUnit()); cg001A.setUnit(finalPz005Map.get(hgsc009A.getInventCode()).getUnit());
cg001A.setInventType(finalPz005Map.get(hgsc009A.getInventCode()).getInventType()); cg001A.setInventType(finalPz005Map.get(hgsc009A.getInventCode()).getInventType());
DaoUtils.insert(HGCG001A.INSERT, cg001A); DaoUtils.insert(HGCG001A.INSERT, cg001A);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC007B">
<sql id="column">
id as "id",
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", <!-- 更新时间 -->
delete_flag as "deleteFlag", <!-- 0=未删除,1=已删除 -->
order_id as "orderId", <!-- 生产订单ID -->
order_detail_id as "orderDetailId", <!-- 生产订单明细ID -->
task_code as "taskCode", <!-- 任务编码 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<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="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name like concat('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name like concat('%', #groupName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
user_id = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name like concat('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<!-- 去重查询 -->
<select id="queryDistinct" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT DISTINCT
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
ORDER BY FACTORY_CODE DESC, GROUP_CODE DESC, USER_ID DESC
</select>
<select id="countDistinct" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, <!-- 帐套 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
delete_flag, <!-- 0=未删除,1=已删除 -->
order_id, <!-- 生产订单ID -->
order_detail_id, <!-- 生产订单明细ID -->
task_code, <!-- 任务编码 -->
factory_code, <!-- 工厂编号 -->
factory_name, <!-- 工厂名称 -->
group_code, <!-- 工作组编号 -->
group_name, <!-- 工作组名称 -->
user_id, <!-- 用户ID -->
user_name <!-- 用户姓名 -->
) VALUES (
#accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #orderId#, #orderDetailId#, #taskCode#, #factoryCode#,
#factoryName#, #groupCode#, #groupName#, #userId#, #userName#)
</insert>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, dep_code, dep_name, created_by, created_name,
created_time, delete_flag, order_id, order_detail_id, task_code,
factory_code, factory_name, group_code, group_name, user_id, user_name
) VALUES
<iterate open="(" conjunction="),(" close=")" property="rows">
#rows[].accountCode#, #rows[].depCode#, #rows[].depName#, #rows[].createdBy#,
#rows[].createdName#, #rows[].createdTime#, #rows[].deleteFlag#, #rows[].orderId#,
#rows[].orderDetailId#, #rows[].taskCode#, #rows[].factoryCode#,
#rows[].factoryName#, #rows[].groupCode#, #rows[].groupName#,
#rows[].userId#, #rows[].userName#
</iterate>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC007B WHERE id = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC007B
SET
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
order_id = #orderId#, <!-- 生产订单ID -->
order_detail_id = #orderDetailId#, <!-- 生产订单明细ID -->
task_code = #taskCode#, <!-- 任务编码 -->
factory_code = #factoryCode#, <!-- 工厂编号 -->
factory_name = #factoryName#, <!-- 工厂名称 -->
group_code = #groupCode#, <!-- 工作组编号 -->
group_name = #groupName#, <!-- 工作组名称 -->
user_id = #userId#, <!-- 用户ID -->
user_name = #userName# <!-- 用户姓名 -->
WHERE id = #id#
</update>
<!-- 根据订单清除 -->
<update id="deleteByOrder">
UPDATE FROM ${hggpSchema}.HGSC007B
SET DELETE_FLAG = 1
<include refid="SqlBase.updateRevise"/>
WHERE ORDER_DETAIL_ID = #orderDetailId#
</update>
</sqlMap>
...@@ -28,6 +28,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC005A; ...@@ -28,6 +28,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006; import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A; import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009; import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A; import com.baosight.hggp.hg.sc.domain.HGSC009A;
...@@ -1580,6 +1581,29 @@ public class HGSCTools { ...@@ -1580,6 +1581,29 @@ public class HGSCTools {
} }
/** /**
* HGSC007B SQL 定义
*
* @author:songx
* @date:2024/9/14,14:34
*/
public static class HgSc007B {
/**
* 根据用户查询
*
* @param userId
* @return
*/
public static List<HGSC007B> listByUser(String userId) {
AssertUtils.isEmpty(userId, "用户ID不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGSC007B.FIELD_user_id, userId);
return DaoBase.getInstance().query(HGSC007B.QUERY, queryMap);
}
}
/**
* @author:songx * @author:songx
* @date:2024/9/10,9:27 * @date:2024/9/10,9:27
*/ */
......
package com.baosight.hggp.hg.sc.util; package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.xservices.xs.util.LoginUserDetails; import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -31,17 +38,84 @@ public class HgScUtils { ...@@ -31,17 +38,84 @@ public class HgScUtils {
* @param queryMap * @param queryMap
*/ */
public static void setOrgCondition(Map queryMap) { public static void setOrgCondition(Map queryMap) {
String userId = UserSessionUtils.getLoginName();
// 超级管理员看所有数据 // 超级管理员看所有数据
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { if (LoginUserDetails.isUserAdmin(userId)) {
return; return;
} }
// 查询自己所在组的任务 added by songx at 20240820 // 查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName(); List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) { // 查询历史分配的组任务
queryMap.put("groupNames", allGroupNames); List<HGSC007B> dbSc007Bs = HGSCTools.HgSc007B.listByUser(userId);
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0); if (CollectionUtils.isEmpty(allGroupNames) && CollectionUtils.isEmpty(dbSc007Bs)) {
return;
}
if (allGroupNames == null) {
allGroupNames = new ArrayList<>();
}
if (dbSc007Bs != null) {
List<String> historyGroupNames = dbSc007Bs.stream().map(HGSC007B::getGroupName)
.collect(Collectors.toList());
// 合并班组信息
allGroupNames.addAll(historyGroupNames);
}
queryMap.put("groupNames", allGroupNames.stream().distinct().collect(Collectors.toList()));
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
}
}
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:35
*/
public static class HgSc007B {
/**
* 新增组人员
*
* @param sc007
*/
public static void addGroupUser(HGSC007 sc007) {
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
}
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
/**
* 更新组人员
*
* @param sc007
*/
public static void modifyGroupUser(HGSC007 sc007) {
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, sc007);
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
} }
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
} }
} }
} }
...@@ -214,6 +214,19 @@ public class HGXSTools { ...@@ -214,6 +214,19 @@ public class HGXSTools {
/** /**
* 查询用户 * 查询用户
* *
* @param orgId
* @return
*/
public static List<User> queryByOrg(String orgId) {
AssertUtils.isEmpty(orgId, "组织ID不能为空");
Map paramMap = new HashMap();
paramMap.put("orgId", orgId);
return DaoBase.getInstance().query(HGSqlConstant.HgXsUser.QUERY_BY_ORG, paramMap);
}
/**
* 查询用户
*
* @param orgIds * @param orgIds
* @return * @return
*/ */
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007B.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
......
...@@ -10,18 +10,18 @@ $(function () { ...@@ -10,18 +10,18 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [10, 20, 50, 70, 100],
}, },
columns: [ columns: [{
{ field: "operator",
field: "operator", template: function (item) {
template: function (item) { let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + + 'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>';
'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>'; template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>';
+ 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>'; template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
return template; + 'onclick="showGroupUser(' + item.id + ')" >人员明细</a>';
} return template;
} }
], }],
loadComplete: function(grid) { loadComplete: function(grid) {
}, },
onSuccess: function (e) { onSuccess: function (e) {
...@@ -68,3 +68,16 @@ function showUploadFile(id) { ...@@ -68,3 +68,16 @@ function showUploadFile(id) {
}); });
} }
/**
* 显示班组人员明细
*
* @param orderCode
*/
function showGroupUser(id) {
JSColorbox.open({
href: "HGSC007B?inqu_status-0-orderId=" + id,
title: "<div style='text-align: center;'>班组人员明细</div>",
width: "85%",
height: "80%",
});
}
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" /> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="200" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: []
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 初始化
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="派工人员明细">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="orderId" cname="生产订单ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="orderDetailId" cname="生产订单明细ID" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="factoryName" cname="厂区名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="groupName" cname="班组名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="userName" cname="人员姓名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="数据集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="factoryName" cname="厂区名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupCode" cname="班组编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupName" cname="班组名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="人员ID" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="人员名称" enable="false" width="120" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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