Commit 92a90a2f by liuyang

2024-08-06 物料清单导入优化,导入存货编码不存在就新增存货档案

parent c636949a
......@@ -268,6 +268,9 @@
FLOW_ID
)
VALUES (#id#, #accountCode#, #depCode#, #inventType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #length#, #width#, #thick#, #material#, #coefficient#, #unit#, #status#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#,#flowId#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) FROM ${hggpSchema}.HGPZ005
</selectKey>
</insert>
<delete id="delete">
......
......@@ -240,8 +240,8 @@ public class HGPZTools {
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
List<HGPZ005> results = DaoBase.getInstance().query(HGPZ005.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("物料编码[%s]不存在", inventCode));
return results.get(0);
//AssertUtils.isEmpty(results, String.format("物料编码[%s]不存在", inventCode));
return results.size() == 0 ? null :results.get(0);
}
/**
......
......@@ -57,6 +57,9 @@ public class HGSC004A extends DaoEPBase {
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_MATERIAL = "material"; /* 材质*/
public static final String FIELD_COEFFICIENT = "coefficient"; /* 系数*/
public static final String FIELD_UNIT = "unit"; /* 单位*/
public static final String COL_id = "id"; /* 主键*/
public static final String COL_company_code = "company_code"; /* 公司编码(预留)*/
......@@ -144,6 +147,9 @@ public class HGSC004A extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private String material = " "; /* 材质*/
private BigDecimal coefficient = new BigDecimal("0"); /* 系数*/
private String unit = " "; /* 单位*/
private Long techFlowId = new Long(0); /* 工艺流程id*/
private String finishDate = " "; /* 完工日期*/
......@@ -242,7 +248,7 @@ public class HGSC004A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_invent_type);
eiColumn.setFieldLength(32);
eiColumn.setDescName("档案类型");
eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_spec);
......@@ -348,7 +354,20 @@ public class HGSC004A extends DaoEPBase {
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MATERIAL);
eiColumn.setDescName("材质");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COEFFICIENT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("系数");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT);
eiColumn.setDescName("单位");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -855,6 +874,30 @@ public class HGSC004A extends DaoEPBase {
this.spec = spec;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public BigDecimal getCoefficient() {
return coefficient;
}
public void setCoefficient(BigDecimal coefficient) {
this.coefficient = coefficient;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
/**
* get the value from Map.
*
......@@ -898,6 +941,9 @@ public class HGSC004A extends DaoEPBase {
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));
setMaterial(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MATERIAL)), material));
setCoefficient(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_COEFFICIENT)), coefficient));
setUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UNIT)), unit));
}
/**
......@@ -942,7 +988,9 @@ public class HGSC004A extends DaoEPBase {
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_MATERIAL, StringUtils.toString(material, eiMetadata.getMeta(FIELD_MATERIAL)));
map.put(FIELD_COEFFICIENT, StringUtils.toString(coefficient, eiMetadata.getMeta(FIELD_COEFFICIENT)));
map.put(FIELD_UNIT, StringUtils.toString(unit, eiMetadata.getMeta(FIELD_UNIT)));
return map;
}
}
......@@ -372,16 +372,36 @@ public class HGSCTools {
AssertUtils.isTrue(true, "数量不能为0!");
}
hgsc004a.setTotalWeight(hgsc004a.getQuantity().multiply(hgsc004a.getSingleWeight()));
HGPZ005 hgpz005= HGPZTools.HgPz005.get(hgsc004a.getProductCode());
if (Objects.isNull(hgpz005)){
AssertUtils.isTrue(true, "产品编号不存在!");
HGPZ005 pz005= HGPZTools.HgPz005.get(hgsc004a.getProductCode());
if (pz005 == null){
List<HGPZ004> hgpz004s = DaoBase.getInstance().query(HGPZ004.QUERY, new HashMap<String, Object>(){{
put(HGPZ004.FIELD_STATUS, CommonConstant.YesNo.YES_1);
}});
Map parmap = hgpz004s.stream().collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1));
String inventType = com.baosight.hggp.util.MapUtils.getString(parmap, com.baosight.hggp.util.StringUtils.trimToEmpty(hgsc004a.getInventType()));
AssertUtils.isEmpty(inventType, String.format("存货类型[%s]代码不存在,添加失败!", hgsc004a.getInventType()));
pz005 = new HGPZ005();
pz005.setInventType(inventType);
pz005.setInventCode(hgsc004a.getProductCode());
pz005.setInventName(hgsc004a.getProductName());
pz005.setSpec(hgsc004a.getSpec());
pz005.setInventTypeDetail(Integer.valueOf(hgsc004a.getProductType()));
pz005.setLength(hgsc004a.getLength());
pz005.setWidth(hgsc004a.getWidth());
pz005.setThick(hgsc004a.getThick());
pz005.setMaterial(hgsc004a.getMaterial());
pz005.setCoefficient(hgsc004a.getCoefficient());
pz005.setUnit(hgsc004a.getUnit());
pz005.setStatus(1); //默认启用
DaoUtils.insert(HGPZ005.INSERT,pz005);
}
hgsc004a.setProductId(hgpz005.getId());
hgsc004a.setInventType(hgpz005.getInventType()+"");
hgsc004a.setProductType(hgpz005.getInventTypeDetail()+"");
hgsc004a.setLength(hgpz005.getLength());
hgsc004a.setWidth(hgpz005.getWidth());
hgsc004a.setThick(hgpz005.getThick());
hgsc004a.setProductId(pz005.getId());
hgsc004a.setInventType(pz005.getInventType()+"");
hgsc004a.setProductType(pz005.getInventTypeDetail()+"");
hgsc004a.setLength(pz005.getLength());
hgsc004a.setWidth(pz005.getWidth());
hgsc004a.setThick(pz005.getThick());
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
//主表全部提交时需要有改变状态
/*if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
......
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