Commit 28666e0d by 宋祥

1.fixBug:生产任务明细不重复新增

parent b10c0f73
...@@ -48,10 +48,8 @@ public class HPConstant { ...@@ -48,10 +48,8 @@ public class HPConstant {
public static final String OTHER_ENTER_NO = "OTHER_ENTER_NO"; public static final String OTHER_ENTER_NO = "OTHER_ENTER_NO";
// 其他出库单号 // 其他出库单号
public static final String OTHER_OUTER_NO = "OTHER_OUTER_NO"; public static final String OTHER_OUTER_NO = "OTHER_OUTER_NO";
//生产计划单 //生产计划单
public static final String HPSC003_PROD_NO = "HPSC003_PROD_NO"; public static final String HPSC003_PROD_NO = "HPSC003_PROD_NO";
//生产订单 //生产订单
public static final String HPSC005_PROD_NO = "HPSC005_PROD_NO"; public static final String HPSC005_PROD_NO = "HPSC005_PROD_NO";
//生产任务订单 //生产任务订单
......
...@@ -23,7 +23,7 @@ public class HPSC003 extends DaoEPBase { ...@@ -23,7 +23,7 @@ public class HPSC003 extends DaoEPBase {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; public static final String FIELD_ID = "id";
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_PROJ_TYPE = "projType"; /* 项目类型*/ public static final String FIELD_PROJ_TYPE = "projType"; /* 项目类型*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
...@@ -45,7 +45,7 @@ public class HPSC003 extends DaoEPBase { ...@@ -45,7 +45,7 @@ public class HPSC003 extends DaoEPBase {
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; public static final String FIELD_INVENT_RECORD_ID = "inventRecordId";
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_PROJ_TYPE = "PROJ_TYPE"; /* 项目类型*/ public static final String COL_PROJ_TYPE = "PROJ_TYPE"; /* 项目类型*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/ public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
...@@ -64,13 +64,13 @@ public class HPSC003 extends DaoEPBase { ...@@ -64,13 +64,13 @@ public class HPSC003 extends DaoEPBase {
public static final String COL_REMARK = "REMARK"; /* 备注*/ public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID";
public static final String QUERY = "t_hpsc003.query"; public static final String QUERY = "HPSC003.query";
public static final String COUNT = "t_hpsc003.count"; public static final String COUNT = "HPSC003.count";
public static final String INSERT = "t_hpsc003.insert"; public static final String INSERT = "HPSC003.insert";
public static final String UPDATE = "t_hpsc003.update"; public static final String UPDATE = "HPSC003.update";
public static final String DELETE = "t_hpsc003.delete"; public static final String DELETE = "HPSC003.delete";
private Long id = new Long(0); private Long id = new Long(0);
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private Integer projType = new Integer(0); /* 项目类型*/ private Integer projType = new Integer(0); /* 项目类型*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
...@@ -233,7 +233,7 @@ public class HPSC003 extends DaoEPBase { ...@@ -233,7 +233,7 @@ public class HPSC003 extends DaoEPBase {
/** /**
* set the id . * set the id .
* *
* @param id * @param id
*/ */
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
......
...@@ -10,6 +10,7 @@ import com.baosight.hpjx.hp.sc.domain.HPSC003; ...@@ -10,6 +10,7 @@ import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC004; import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -20,6 +21,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -20,6 +21,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -357,56 +359,66 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -357,56 +359,66 @@ public class ServiceHPSC002 extends ServiceBase {
*/ */
public void autoPlanInfo(String id) { public void autoPlanInfo(String id) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HPSC002 THPSC002 = (HPSC002) dao.get("HPSC002.queryEntityByParentPrtdCode","id",id); HPSC002 dbSc002 = (HPSC002) dao.get("HPSC002.queryEntityByParentPrtdCode","id",id);
String SCJHD = SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC003_PROD_NO); String SCJHD = SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC003_PROD_NO);
//生成生产计划t_hpsc003 // 生成生产计划t_hpsc003,如果已存在就不新增
HPSC003 HPSC003 = new HPSC003(); Map queryMap = new HashMap();
HPSC003.setCompanyCode(""); queryMap.put("matId", dbSc002.getId());
HPSC003.setProjType(null); List<HPSC003> dbSc003s = dao.query(HPSC003.QUERY, queryMap);
HPSC003.setProjCode(THPSC002.getProjCode()); if (CollectionUtils.isNotEmpty(dbSc003s)) {
HPSC003.setProjName(THPSC002.getProjName()); HPSC003 HPSC003 = new HPSC003();
HPSC003.setPlanInfoNo(SCJHD); HPSC003.setCompanyCode("");
HPSC003.setInventRecordId(THPSC002.getInventRecordId()); HPSC003.setProjType(null);
HPSC003.setPrdtType(THPSC002.getPrdtType()); HPSC003.setProjCode(dbSc002.getProjCode());
HPSC003.setPrdtCode(THPSC002.getPrdtCode()); HPSC003.setProjName(dbSc002.getProjName());
HPSC003.setPrdtName(THPSC002.getPrdtName()); HPSC003.setPlanInfoNo(SCJHD);
HPSC003.setSpec(THPSC002.getSpec()); HPSC003.setInventRecordId(dbSc002.getInventRecordId());
HPSC003.setLength(THPSC002.getLength()); HPSC003.setPrdtType(dbSc002.getPrdtType());
HPSC003.setWidth(THPSC002.getWidth()); HPSC003.setPrdtCode(dbSc002.getPrdtCode());
HPSC003.setThick(THPSC002.getThick()); HPSC003.setPrdtName(dbSc002.getPrdtName());
HPSC003.setRemark(THPSC002.getRemark()); HPSC003.setSpec(dbSc002.getSpec());
HPSC003.setPlanCompletionDate(""); HPSC003.setLength(dbSc002.getLength());
HPSC003.setStatus(0); HPSC003.setWidth(dbSc002.getWidth());
HPSC003.setMatId(THPSC002.getId()); HPSC003.setThick(dbSc002.getThick());
DaoUtils.insert("HPSC003.insert", HPSC003.toMap()); HPSC003.setRemark(dbSc002.getRemark());
HPSC003.setPlanCompletionDate("");
//生产计划详情 HPSC003.setStatus(0);
Map queryMap = new HashMap(); HPSC003.setMatId(dbSc002.getId());
DaoUtils.insert("HPSC003.insert", HPSC003.toMap());
}
// 生产计划详情
queryMap = new HashMap();
queryMap.put("parentId", id); queryMap.put("parentId", id);
List<HPSC002> rows = this.dao.query("HPSC002.queryEntityByParentPrtdCode", queryMap); List<HPSC002> rows = this.dao.query("HPSC002.queryEntityByParentPrtdCode", queryMap);
for (int i = 0; i < rows.size(); i++) { for (int i = 0; i < rows.size(); i++) {
HPSC002 HPSC002 = rows.get(i); HPSC002 dbSc002Child = rows.get(i);
// 明细已存在就不在新增
queryMap = new HashMap();
queryMap.put("filePath1", dbSc002Child.getId());
List<HPSC004> dbSc004s = dao.query(HPSC004.QUERY, queryMap);
if (CollectionUtils.isNotEmpty(dbSc004s)) {
continue;
}
HPSC004 HPSC004 = new HPSC004(); HPSC004 HPSC004 = new HPSC004();
HPSC004.setCompanyCode(""); HPSC004.setCompanyCode("");
HPSC004.setDeptCode(""); HPSC004.setDeptCode("");
HPSC004.setProjCode(HPSC002.getProjCode()); HPSC004.setProjCode(dbSc002Child.getProjCode());
HPSC004.setProjName(HPSC002.getProjName()); HPSC004.setProjName(dbSc002Child.getProjName());
HPSC004.setParentId(SCJHD); HPSC004.setParentId(SCJHD);
HPSC004.setParentPrdtName(HPSC002.getParentPrdtName()); HPSC004.setParentPrdtName(dbSc002Child.getParentPrdtName());
HPSC004.setInventRecordId(HPSC002.getInventRecordId()); HPSC004.setInventRecordId(dbSc002Child.getInventRecordId());
HPSC004.setPrdtType(HPSC002.getPrdtType()); HPSC004.setPrdtType(dbSc002Child.getPrdtType());
HPSC004.setPrdtCode(HPSC002.getPrdtCode()); HPSC004.setPrdtCode(dbSc002Child.getPrdtCode());
HPSC004.setPrdtName(HPSC002.getPrdtName()); HPSC004.setPrdtName(dbSc002Child.getPrdtName());
HPSC004.setSpec(HPSC002.getSpec()); HPSC004.setSpec(dbSc002Child.getSpec());
HPSC004.setLength(HPSC002.getLength()); HPSC004.setLength(dbSc002Child.getLength());
HPSC004.setWidth(HPSC002.getWidth()); HPSC004.setWidth(dbSc002Child.getWidth());
HPSC004.setThick(HPSC002.getThick()); HPSC004.setThick(dbSc002Child.getThick());
HPSC004.setRemark(HPSC002.getRemark()); HPSC004.setRemark(dbSc002Child.getRemark());
HPSC004.setNum(HPSC002.getNum()); HPSC004.setNum(dbSc002Child.getNum());
HPSC004.setUnitWt(HPSC002.getUnitWt()); HPSC004.setUnitWt(dbSc002Child.getUnitWt());
HPSC004.setTotalWt(HPSC002.getTotalWt()); HPSC004.setTotalWt(dbSc002Child.getTotalWt());
HPSC004.setFilePath1(HPSC002.getId().toString()); HPSC004.setFilePath1(dbSc002Child.getId().toString());
HPSC004.setPlanCommentDate(""); HPSC004.setPlanCommentDate("");
HPSC004.setPlanCompletionDate(""); HPSC004.setPlanCompletionDate("");
HPSC004.setActualCompletionNum(NumberUtils.toBigDecimal(0.00)); HPSC004.setActualCompletionNum(NumberUtils.toBigDecimal(0.00));
......
...@@ -227,7 +227,7 @@ public class ServiceHPSC003 extends ServiceBase { ...@@ -227,7 +227,7 @@ public class ServiceHPSC003 extends ServiceBase {
for (int i = 0; i < list.size(); i ++) { for (int i = 0; i < list.size(); i ++) {
HPSC004 HPSC004 = (HPSC004) list.get(i); HPSC004 HPSC004 = (HPSC004) list.get(i);
HPSC005 HPSC005 = new HPSC005(); HPSC005 HPSC005 = new HPSC005();
String SCDD = SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC003_PROD_NO); String SCDD = SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC005_PROD_NO);
HPSC005.setProjCode(HPSC003.getProjCode()); HPSC005.setProjCode(HPSC003.getProjCode());
HPSC005.setProjName(HPSC003.getProjName()); HPSC005.setProjName(HPSC003.getProjName());
HPSC005.setProductionOrderNo(SCDD); HPSC005.setProductionOrderNo(SCDD);
......
...@@ -10,6 +10,7 @@ import com.baosight.hpjx.hp.kc.domain.HPKC010; ...@@ -10,6 +10,7 @@ import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.pz.domain.HPPZ004; import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC004; import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005; import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A; import com.baosight.hpjx.hp.sc.domain.HPSC005A;
...@@ -146,6 +147,30 @@ public class HPSCTools { ...@@ -146,6 +147,30 @@ public class HPSCTools {
} }
/** /**
* HPSC003公共DAO定义
*
* @author:songx
* @date:2024/2/4,10:17
*/
public static class HpSc003 {
/**
* 查询
*
* @param id
* @return
*/
public static HPSC003 get(Long id) {
AssertUtils.isNull(id, "部件编码不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPSC003> results = DaoBase.getInstance().query(HPSC003.QUERY, queryMap);
AssertUtils.isNull(results, String.format("物料ID[%s]信息不存在", id));
return results.get(0);
}
}
/**
* HPSC005公共DAO定义 * HPSC005公共DAO定义
* *
* @author:songx * @author:songx
......
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