Commit 1269c0e9 by 江和松

物料清单明细页面操作处理、提交处理,生成生产计划等操作

parent 2954f6b8
......@@ -5,7 +5,7 @@ package com.baosight.hggp.hg.constant;
* @date:2024/1/18,17:16
*/
public class HGConstant {
/**
* 序列号
*
......@@ -13,7 +13,7 @@ public class HGConstant {
* @date:2021/8/17,15:22
*/
public static class SequenceId {
// 用户ID
public static final String USER_ID = "USER_ID";
// 组织机构编码
......@@ -40,7 +40,7 @@ public class HGConstant {
public static final String WH_CODE = "HGPZ007_WH_CODE";
// 项目性质编码
public static final String NAT_CODE = "HGPZ008_NAT_CODE";
//项目档案编号
public static final String PROJ_NUMBER = "PROJ_NUMBER";
// 盘点单号
......@@ -114,7 +114,7 @@ public class HGConstant {
* @date:2024/2/22,13:57
*/
public static class CgPlanStatus {
// 待审核
public static final Integer S_0 = 0;
// 审核中
......@@ -126,7 +126,7 @@ public class HGConstant {
// 生成合同
public static final Integer S_4 = 4;
}
/**
* 采购合同状态
*
......@@ -134,7 +134,7 @@ public class HGConstant {
* @date:2024/2/22,13:57
*/
public static class CgContractStatus {
// 待审核
public static final Integer S_0 = 0;
// 审核中
......@@ -168,7 +168,7 @@ public class HGConstant {
// 已入库
public static final Integer S_5 = 5;
}
/**
* 库存类型
*
......@@ -176,7 +176,7 @@ public class HGConstant {
* @date:2024/1/20,15:18
*/
public static class KcType {
// 采购
public static final String CG = "CG";
// 生产
......@@ -241,4 +241,21 @@ public class HGConstant {
public static final Integer YTJ = 1;
}
/**
*
* 物料变动状态
* @author:songx
* @date:2024/5/15,15:18
*/
public static class ChangeType {
// 默认保存
public static final Integer BC = 0;
// 增加
public static final Integer ZJ = 1;
// 替换
public static final Integer TH = 2;
// 删除
public static final Integer SC = 3;
}
}
......@@ -64,6 +64,7 @@ public class HGSC004 extends DaoEPBase {
public static final String COL_del_status = "del_status"; /* 数据状态 0:保存,1:删除*/
public static final String QUERY = "HGSC004.query";
public static final String QUERY_BY_ID = "HGSC004.queryById";
public static final String COUNT = "HGSC004.count";
public static final String INSERT = "HGSC004.insert";
public static final String UPDATE = "HGSC004.update";
......@@ -93,6 +94,10 @@ public class HGSC004 extends DaoEPBase {
private String updatedTime = " "; /* 更新时间*/
private Integer delStatus = new Integer(0); /* 数据状态 0:保存,1:删除*/
private String finishDate = " "; /* 完工日期*/
/**
* initialize the metadata.
*/
......@@ -527,6 +532,14 @@ public class HGSC004 extends DaoEPBase {
this.delStatus = delStatus;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
/**
* get the value from Map.
*
......
......@@ -85,11 +85,13 @@ public class HGSC004A extends DaoEPBase {
public static final String COL_updated_time = "updated_time"; /* 更新时间*/
public static final String QUERY = "HGSC004A.query";
public static final String QUERY_BY_MATERIAL_ID = "HGSC004A.queryByMaterialId";
public static final String COUNT = "HGSC004A.count";
public static final String INSERT = "HGSC004A.insert";
public static final String UPDATE = "HGSC004A.update";
public static final String DELETE = "HGSC004A.delete";
public static final String BATCH_DELETE = "HGSC004A.batchDelete";
public static final String BATCH_CHANGE_TYPE = "HGSC004A.changeType";
public static final String QUERY_ALL = "HGSC004A.queryAll";
public static final String UPDATE_PRODUCT_STATUS = "HGSC004A.updateProductStatus";
......@@ -126,6 +128,9 @@ public class HGSC004A extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private Long techFlowId = new Long(0); /* 工艺流程id*/
private String finishDate = " "; /* 完工日期*/
/**
* initialize the metadata.
*/
......@@ -747,6 +752,22 @@ public class HGSC004A extends DaoEPBase {
this.productType = productType;
}
public Long getTechFlowId() {
return techFlowId;
}
public void setTechFlowId(Long techFlowId) {
this.techFlowId = techFlowId;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
/**
* get the value from Map.
*
......
package com.baosight.hggp.hg.sc.service;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -32,7 +31,7 @@ public class ServiceHGSC004A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A());
// inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A());
Map map = new HashMap();
map.put(HGSC004A.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo,
......@@ -65,7 +64,33 @@ public class ServiceHGSC004A extends ServiceBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 蓝图ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC004A.FIELD_id);
DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
HGSC004A hgsc004a = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,ids.get(0));
Map<String,Object> mapA = new HashMap<>();
mapA.put("ids",ids);
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC004A.FIELD_id,hgsc004AList.get(0).getMaterialId());
if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
DaoUtils.update(HGSC004A.BATCH_CHANGE_TYPE, new HashMap<String,Object>(){{put("ids",ids);put("changeType",HGConstant.ChangeType.SC);}});
for(HGSC004A hgsc004A : hgsc004AList){
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004A.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004A.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.delete(hgsc005a);
}
}else{
DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -104,13 +129,41 @@ public class ServiceHGSC004A extends ServiceBase {
}else{
hgsc004a.setLeaf(1);
}
}
this.checkSaveData(hgsc004a,hgsc003);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
DaoUtils.update(HGSC004A.UPDATE, hgsc004a);
}else {
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
this.checkSaveData(hgsc004a,hgsc003);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.TH);
}
DaoUtils.update(HGSC004A.UPDATE, hgsc004a);
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004a.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.update(hgsc005a);
}else {
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
}
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004a.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.save(hgsc005a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
......@@ -193,23 +246,23 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc004a.fromMap(map);
DaoUtils.update(HGSC004A.UPDATE_PRODUCT_STATUS, hgsc004a);
}
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC001.FIELD_id,hgsc004a.getMaterialId());
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC001.FIELD_id,hgsc004a.getMaterialId());
if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.WTJ.intValue()){
//如果是未提交则修改为部分提交
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("productStatus",HGConstant.ProductStatus.WTJ);
mapA.put("notId",hgsc004a.getId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_ALL,mapA, 0, -999999);
if(!CollectionUtils.isEmpty(hgsc004AList)){
//如果存在就是部分提交
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.BFTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
}else if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.BFTJ.intValue()){
//如果不存在未提交的,就标记主表为全部提交
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("productStatus",HGConstant.ProductStatus.WTJ);
mapA.put("notId",hgsc004a.getId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_ALL,mapA, 0, -999999);
if(!CollectionUtils.isEmpty(hgsc004AList)){
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.QBTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
}
}else{
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.QBTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
//保存生产计划
saveTHGSC005(hgsc004,hgsc004a);
}
}
......@@ -225,5 +278,31 @@ public class ServiceHGSC004A extends ServiceBase {
return inInfo;
}
private void saveTHGSC005(HGSC004 hgsc004,HGSC004A hgsc004a) {
//主表
HGSC005 hgsc005 = new HGSC005();
BeanUtil.copyProperties(hgsc004,hgsc005,"id");
hgsc005.setMatId(hgsc004.getId());
HGSCTools.THGSC005.save(hgsc005);
// 全部提交后,发送计划
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
for(HGSC004A hgsc004A : hgsc004AList){
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004A.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004A.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.save(hgsc005a);
}
}
}
......@@ -91,7 +91,8 @@
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC004 WHERE 1=1
FROM ${hggpSchema}.HGSC004
WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -101,6 +102,42 @@
</select>
<select id="queryById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004">
SELECT
a.id as "id", <!-- 主键 -->
a.blueprint_id as "blueprintId", <!-- 蓝图id -->
a.company_code as "companyCode", <!-- 公司编码 -->
a.company_name as "companyName", <!-- 公司名称 -->
a.dep_code as "depCode", <!-- 部门编号 -->
a.dep_name as "depName", <!-- 部门名称 -->
a.blueprint_code as "blueprintCode", <!-- 蓝图编号 -->
a.blueprint_name as "blueprintName", <!-- 蓝图名称 -->
a.proj_code as "projCode", <!-- 项目编码 -->
a.proj_name as "projName", <!-- 项目名称 -->
a.material_status as "materialStatus", <!-- 物料状态 0:未提交,1:部分提交,2:全部提交 -->
a.approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
a.del_status as "delStatus", <!-- 数据状态 0:保存,1:删除 -->
a.account_code as "accountCode", <!-- 帐套 -->
a.created_by as "createdBy", <!-- 创建人 -->
a.created_name as "createdName", <!-- 创建人名称 -->
a.created_time as "createdTime", <!-- 创建时间 -->
a.updated_by as "updatedBy", <!-- 更新人 -->
a.updated_name as "updatedName", <!-- 修改人名称 -->
a.updated_time as "updatedTime", <!-- 更新时间 -->
b.end_date as "finishDate"
FROM ${hggpSchema}.HGSC004 a
left join ${hggpSchema}.hgsc001 b on a.proj_code = b.proj_code and b.approval_status = 2
WHERE 1=1
and a.id = #id#
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC004 WHERE 1=1
<include refid="condition" />
......
......@@ -122,6 +122,9 @@
<isNotEmpty prepend=" AND " property="notId">
id != #notId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -136,7 +139,6 @@
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<select id="queryAll" parameterClass="java.util.HashMap"
......@@ -153,6 +155,61 @@
</select>
<select id="queryByMaterialId" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004A">
SELECT
a.id as "id", <!-- 主键 -->
a.company_code as "companyCode", <!-- 公司编码(预留) -->
a.company_name as "companyName", <!-- 公司名称(预留) -->
a.dep_code as "depCode", <!-- 部门编号(预留) -->
a.dep_name as "depName", <!-- 部门名称(预留) -->
a.proj_code as "projCode", <!-- 项目编码(预留) -->
a.proj_name as "projName", <!-- 项目名称(预留) -->
a.parent_prod_code as "parentProdCode", <!-- 父节点-产品编码 -->
a.parent_prod_name as "parentProdName", <!-- 父节点-产品名称 -->
a.material_id as "materialId", <!-- 物料清单id -->
a.product_id as "productId", <!-- 产品id -->
a.product_type as "productType", <!-- 产品类别 -->
a.product_code as "productCode", <!-- 产品编号 -->
a.product_name as "productName", <!-- 产品名称 -->
a.product_status as "productStatus", <!-- 产品状态 0:未提交,1:已提交 -->
a.change_type as "changeType", <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
a.quantity as "quantity", <!-- 数量 -->
a.single_weight as "singleWeight", <!-- 单重 -->
a.total_weight as "totalWeight", <!-- 总重 -->
a.approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
a.leaf as "leaf", <!-- 是否有叶子节点 -->
a.sort as "sort", <!-- 排序字段 -->
a.lv as "lv", <!-- 层级 -->
a.account_code as "accountCode", <!-- 帐套 -->
a.created_by as "createdBy", <!-- 创建人 -->
a.created_name as "createdName", <!-- 创建人名称 -->
a.created_time as "createdTime", <!-- 创建时间 -->
a.updated_by as "updatedBy", <!-- 更新人 -->
a.updated_name as "updatedName", <!-- 修改人名称 -->
a.updated_time as "updatedTime", <!-- 更新时间 -->
b.flow_id as "techFlowId",
c.end_date as "finishDate"
FROM ${hggpSchema}.HGSC004A a
left join ${hggpSchema}.hgpz005 b on a.product_id = b.id
left join ${hggpSchema}.hgsc001 c on a.proj_code = c.proj_code and c.approval_status = 2
WHERE 1=1
<isNotEmpty prepend=" AND " property="materialId">
a.material_id = #materialId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
a.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC004A WHERE 1=1
<include refid="condition" />
......@@ -294,6 +351,17 @@
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete>
<update id="changeType">
UPDATE ${hggpSchema}.HGSC004A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
CHANGE_TYPE = #changeType# <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
<update id="updateProductStatus">
UPDATE ${hggpSchema}.HGSC004A
SET
......
......@@ -279,7 +279,7 @@ $(function () {
var inInfo = new EiInfo();
EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
refreshTree();
}
});
},
......@@ -295,10 +295,10 @@ $(function () {
var inInfo = new EiInfo();
EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) {
tree.reload("root");//更新树
refreshTree();
}
});
refreshTree();
},
toolbarConfig: {
hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
......
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