Commit 6d02b731 by 江和松

1.修改物料清单逻辑

2.增加批量新增逻辑
3.生产入库接口修改
parent 2aceb4f9
......@@ -91,7 +91,7 @@ public enum DdynamicEnum {
* 用途:存货档案下拉框,带id名称等信息
* 编写:
*/
PRODUCT_BLOCK_ID("product_block_id","inventCode","inventName","id","inventType","length","width","thick","HGPZ005.queryProductComboBox"),
PRODUCT_BLOCK_ID("product_block_id","inventCode","inventName","id","inventType","length","width","thick","inventTypeDetail","HGPZ005.queryProductComboBox"),
/**
* 模块:存货档案(ALL)
* 用途:存货档案下拉框
......
......@@ -74,7 +74,7 @@ public class DaoUtils {
}
/**
* update method.
* updateBatch method.
*
* @param sql
* @param parameters
......@@ -91,6 +91,23 @@ public class DaoUtils {
}
/**
* insertBatch method.
*
* @param sql
* @param parameters
*/
public static int insertBatch(String sql, Collection parameters) {
parameters.forEach(obj->{
if (obj instanceof DaoEPBase) {
setRevisor((DaoEPBase) obj, true);
} else if (obj instanceof Map) {
setRevisor((Map) obj, true);
}
});
return DaoBase.getInstance().insertBatch(sql, parameters);
}
/**
* 创建人工号 创建人姓名 创建人岗号 创建时刻
*
* @param bean
......
......@@ -115,6 +115,7 @@ public class HGKC003 extends DaoEPBase {
public static final String UPDATE = "HGKC003.update";
public static final String DELETE = "HGKC003.delete";
public static final String UPDATE_SUBMIT_STATUS = "HGKC003.updateSubmitStatus";
public static final String MAX_ID = "HGKC003.maxId";
private Long id = new Long(0);
private Long qualityId = new Long(0); /* 质检单id*/
......
......@@ -23,6 +23,7 @@ public class HGKC003A extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_QUALITY_DETAIL_ID = "qualityDetailId"; /* 质检单明细ID*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
......@@ -68,6 +69,7 @@ public class HGKC003A extends DaoEPBase {
public static final String FIELD_STORAGE_TYPE = "storageType"; /* 入库类型:0:入库 1:退回*/
public static final String COL_ID = "ID";
public static final String COL_QUALITY_DETAIL_ID = "QUALITY_DETAIL_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_CREATED_BY = "CREATED_BY"; /* 记录创建者*/
......@@ -120,6 +122,7 @@ public class HGKC003A extends DaoEPBase {
public static final String BATCH_DELETE = "HGKC003A.batchDelete";
private Long id = new Long(0);
private Long qualityDetailId = new Long(0); /* 质检单明细ID*/
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
......@@ -175,6 +178,10 @@ public class HGKC003A extends DaoEPBase {
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_QUALITY_DETAIL_ID);
eiColumn.setDescName("质检单明细ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
......@@ -1094,6 +1101,15 @@ public class HGKC003A extends DaoEPBase {
public void setStorageType(Boolean storageType) {
this.storageType = storageType;
}
public Long getQualityDetailId() {
return qualityDetailId;
}
public void setQualityDetailId(Long qualityDetailId) {
this.qualityDetailId = qualityDetailId;
}
/**
* get the value from Map.
*
......@@ -1103,6 +1119,7 @@ public class HGKC003A extends DaoEPBase {
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setQualityDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_QUALITY_DETAIL_ID)), qualityDetailId));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
......@@ -1156,6 +1173,7 @@ public class HGKC003A extends DaoEPBase {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_QUALITY_DETAIL_ID, StringUtils.toString(qualityDetailId, eiMetadata.getMeta(FIELD_QUALITY_DETAIL_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_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
......
......@@ -308,4 +308,8 @@
ID = #id#
</update>
<select id="maxId" resultClass="long">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC003
</select>
</sqlMap>
......@@ -135,12 +135,16 @@
<isNotEmpty prepend=" AND " property="storageType">
STORAGE_TYPE = #storageType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="qualityDetailId">
QUALITY_DETAIL_ID = #qualityDetailId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC003A">
SELECT
ID as "id",
QUALITY_DETAIL_ID as "qualityDetailId",<!-- 企业编码 -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
......@@ -204,7 +208,8 @@
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC003A (ID,
INSERT INTO ${hggpSchema}.HGKC003A (
QUALITY_DETAIL_ID,<!-- 企业编码 -->
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
......@@ -249,7 +254,7 @@
AMOUNT, <!-- 金额 -->
STORAGE_TYPE <!-- 入库类型:0:入库 1:退回 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #depositDate#, #depositNo#, #whCode#, #whName#, #invQty#, #invUnitWeight#, #invWeight#, #depositNoOld#, #remark#, #factoryCode#, #prodOrderNo#, #prodTaskNo#, #projCode#, #projName#, #prdtType#, #prdtCode#, #prdtName#, #prdtLength#, #prdtWidth#, #prdtThick#, #prdtSpec#, #partType#, #partCode#, #partName#, #partLength#, #partWidth#, #partThick#, #partSpec#, #primaryId#, #price#, #amount#, #storageType#)
VALUES (#qualityDetailId#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #depositDate#, #depositNo#, #whCode#, #whName#, #invQty#, #invUnitWeight#, #invWeight#, #depositNoOld#, #remark#, #factoryCode#, #prodOrderNo#, #prodTaskNo#, #projCode#, #projName#, #prdtType#, #prdtCode#, #prdtName#, #prdtLength#, #prdtWidth#, #prdtThick#, #prdtSpec#, #partType#, #partCode#, #partName#, #partLength#, #partWidth#, #partThick#, #partSpec#, #primaryId#, #price#, #amount#, #storageType#)
</insert>
<delete id="delete">
......@@ -265,6 +270,7 @@
<update id="update">
UPDATE ${hggpSchema}.HGKC003A
SET
QUALITY_DETAIL_ID = #qualityDetailId#,<!-- 企业编码 -->
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
......
......@@ -5,6 +5,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.StringUtils;
......@@ -131,21 +132,39 @@ public class HGKCTools {
public static class HgKc003 {
public static HGKC003 save(HGKC003 hgkc003){
checkSaveData(hgkc003);
public static HGKC003 save(HGKC003 hgkc003,List<HGKC003A> hgkc003aList){
checkSaveData(hgkc003,hgkc003aList);
hgkc003.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROD_DEPOSIT_NO));
Long maxId = (Long)DaoBase.getInstance().get(HGKC003.MAX_ID,null,null);
Long setId = maxId+1;
hgkc003.setId(setId);
DaoUtils.insert(HGKC003.INSERT,hgkc003);
hgkc003aList.forEach(o->{
o.setPrimaryId(setId);
});
DaoUtils.insertBatch(HGKC003A.INSERT,hgkc003aList);
return hgkc003;
}
private static void checkSaveData(HGKC003 hgkc003) {
private static void checkSaveData(HGKC003 hgkc003,List<HGKC003A> hgkc003aList) {
AssertUtils.isEmpty(hgkc003.getCompanyCode(), "公司编码不能为空!");
AssertUtils.isEmpty(hgkc003.getCompanyName(), "公司名称不能为空!");
AssertUtils.isEmpty(hgkc003.getWhCode(), "仓库编码不能为空!");
AssertUtils.isEmpty(hgkc003.getWhName(), "仓库名称不能为空!");
AssertUtils.isEmpty(hgkc003.getProjCode(), "项目编号不能为空!");
AssertUtils.isEmpty(hgkc003.getProjName(), "项目名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgkc003.getQualityId())||hgkc003.getQualityId()<=0, "质检单idID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgkc003.getQualityId())||hgkc003.getQualityId()<=0, "质检单ID不能为空!");
for(HGKC003A hgkc003a : hgkc003aList){
AssertUtils.isEmpty(hgkc003a.getCompanyCode(), "公司编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getCompanyName(), "公司名称不能为空!");
AssertUtils.isEmpty(hgkc003a.getProjCode(), "项目编号不能为空!");
AssertUtils.isEmpty(hgkc003a.getProjName(), "项目名称不能为空!");
AssertUtils.isEmpty(hgkc003a.getWhCode(), "仓库编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getWhName(), "仓库名称不能为空!");
AssertUtils.isEmpty(hgkc003a.getPrdtCode(), "存货编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getPrdtName(), "存货名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgkc003a.getQualityDetailId())||hgkc003a.getQualityDetailId()<=0, "质检单明细ID不能为空!");
}
}
/**
......@@ -207,8 +226,13 @@ public class HGKCTools {
private static void checkSaveData(HGKC003A hgkc003a) {
AssertUtils.isEmpty(hgkc003a.getCompanyCode(), "公司编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getCompanyName(), "公司名称不能为空!");
// AssertUtils.isTrue(Objects.isNull(hgkc003.getQualityId())||hgkc003.getQualityId()<=0, "质检单idID不能为空!");
AssertUtils.isEmpty(hgkc003a.getProjCode(), "项目编号不能为空!");
AssertUtils.isEmpty(hgkc003a.getProjName(), "项目名称不能为空!");
AssertUtils.isEmpty(hgkc003a.getWhCode(), "仓库编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getWhName(), "仓库名称不能为空!");
AssertUtils.isEmpty(hgkc003a.getPrdtCode(), "存货编码不能为空!");
AssertUtils.isEmpty(hgkc003a.getPrdtName(), "存货名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgkc003a.getQualityDetailId())||hgkc003a.getQualityDetailId()<=0, "质检单明细ID不能为空!");
}
}
......
......@@ -345,10 +345,11 @@
a.INVENT_TYPE as "inventType",
a.INVENT_CODE as "inventCode",
a.INVENT_NAME as "inventName",
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
b.PAR_INVENT_TYPE as "parInventType"
a.LENGTH as "length", <!-- 长 -->
a.WIDTH as "width", <!-- 宽 -->
a.THICK as "thick", <!-- 厚 -->
b.PAR_INVENT_TYPE as "parInventType",
b.INVENT_TYPE_DETAIL as "inventTypeDetail"
FROM ${hggpSchema}.HGPZ005 a
left join ${hggpSchema}.hgpz004 b on a.INVENT_TYPE = b.INVENT_TYPE and b.STATUS=1 and b.DELETE_FLAG = 0
WHERE a.DELETE_FLAG = 0
......
......@@ -165,38 +165,31 @@ public class ServiceHGSC004 extends ServiceBase {
* @param hgsc004
*/
private void insertTree(HGSC004 hgsc004) {
//变更清单里面的公司、项目信息
Map<String,Object> map = new HashMap<>();
map.put("companyCode",hgsc004.getCompanyCode());
map.put("projCode",hgsc004.getProjCode());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_ALL,map, 0, -999999);
if(CollectionUtils.isEmpty(hgsc004AList)){
//录入树结构,公司
HGSC004A rootHgsc004A = new HGSC004A();
BeanUtil.copyProperties(hgsc004,rootHgsc004A,"id");
//因为获取不到id,所以根据公司编号+项目编号得到树结构
rootHgsc004A.setMaterialId(hgsc004.getId());
rootHgsc004A.setParentProdCode("root");
rootHgsc004A.setParentProdName(hgsc004.getCompanyName());
rootHgsc004A.setLeaf(2);//有叶子节点
rootHgsc004A.setLv(1);
rootHgsc004A.setSort(1);
rootHgsc004A.setProductCode(hgsc004.getCompanyCode());
rootHgsc004A.setProductName(hgsc004.getCompanyName());
DaoUtils.insert(HGSC004A.INSERT, rootHgsc004A);
//录入2级目录,项目
HGSC004A projectHgsc004A = new HGSC004A();
BeanUtil.copyProperties(hgsc004,projectHgsc004A,"id");
projectHgsc004A.setMaterialId(hgsc004.getId());
projectHgsc004A.setParentProdCode(rootHgsc004A.getProductCode());
projectHgsc004A.setParentProdName(rootHgsc004A.getProductName());
projectHgsc004A.setLeaf(2);//有叶子节点
projectHgsc004A.setLv(2);
projectHgsc004A.setSort(1);
projectHgsc004A.setProductCode(hgsc004.getProjCode());
projectHgsc004A.setProductName(hgsc004.getProjName());
DaoUtils.insert(HGSC004A.INSERT, projectHgsc004A);
}
//录入树结构,公司
HGSC004A rootHgsc004A = new HGSC004A();
BeanUtil.copyProperties(hgsc004,rootHgsc004A,"id");
//因为获取不到id,所以根据公司编号+项目编号得到树结构
rootHgsc004A.setMaterialId(hgsc004.getId());
rootHgsc004A.setParentProdCode("root");
rootHgsc004A.setParentProdName(hgsc004.getCompanyName());
rootHgsc004A.setLeaf(2);//有叶子节点
rootHgsc004A.setLv(1);
rootHgsc004A.setSort(1);
rootHgsc004A.setProductCode(hgsc004.getCompanyCode());
rootHgsc004A.setProductName(hgsc004.getCompanyName());
DaoUtils.insert(HGSC004A.INSERT, rootHgsc004A);
//录入2级目录,项目
HGSC004A projectHgsc004A = new HGSC004A();
BeanUtil.copyProperties(hgsc004,projectHgsc004A,"id");
projectHgsc004A.setMaterialId(hgsc004.getId());
projectHgsc004A.setParentProdCode(rootHgsc004A.getProductCode());
projectHgsc004A.setParentProdName(rootHgsc004A.getProductName());
projectHgsc004A.setLeaf(2);//有叶子节点
projectHgsc004A.setLv(2);
projectHgsc004A.setSort(1);
projectHgsc004A.setProductCode(hgsc004.getProjCode());
projectHgsc004A.setProductName(hgsc004.getProjName());
DaoUtils.insert(HGSC004A.INSERT, projectHgsc004A);
}
......
......@@ -122,7 +122,7 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc004a.setMaterialId(hgsc004.getId());
hgsc004a.setLv(hgsc004a.getLv() + 1);
//不为4级都有叶子节点
if(hgsc004a.getLv().intValue() <= 4){
if(hgsc004a.getLv().intValue() < 4){
hgsc004a.setLeaf(2);
}else{
hgsc004a.setLeaf(1);
......@@ -177,9 +177,18 @@ public class ServiceHGSC004A extends ServiceBase {
private void checkSaveData(HGSC004A hgsc004a,HGSC004 hgsc004) {
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()>0){
//蓝图信息,用于蓝图状态校验
HGSC003 hgsc003 = (HGSC003) super.dao.get(HGSC003.QUERY,HGSC004A.FIELD_id,hgsc004.getBlueprintId());
HGSC003 hgsc003 = (HGSC003) super.dao.get(HGSC003.QUERY,HGSC003.FIELD_id,hgsc004.getBlueprintId());
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
}
//为构件的需要验证是否已经存在了,不能重复添加
if(hgsc004a.getLv().intValue() == 3){
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("productId",hgsc004a.getProductId());
mapA.put("notId",hgsc004a.getId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY,mapA, 0, -999999);
AssertUtils.isTrue(!CollectionUtils.isEmpty(hgsc004AList), "已存在构建"+hgsc004a.getProductName());
}
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgsc004a.getCompanyCode(), "请选择公司!");
......
......@@ -189,6 +189,7 @@ $(function () {
item['length'] = productCodeBox[i]['param3Field'];
item['width'] = productCodeBox[i]['param4Field'];
item['thick'] = productCodeBox[i]['param5Field'];
item['productType'] = productCodeBox[i]['param6Field'];
console.log(item)
template = productCodeBox[i]['valueField'];
}else{
......@@ -261,17 +262,20 @@ $(function () {
// 判断父级节点是否发生变化
if (e.field == "productCode") {
loadChange(grid,e,"productId");
loadChange(grid,e,"inventType");
loadChange(grid,e,"productName");
loadChange(grid,e,"quantity");
loadChange(grid,e,"inventType");
loadChange(grid,e,"length");
loadChange(grid,e,"width");
loadChange(grid,e,"thick");
loadChange(grid,e,"productType");
}
if (e.field == "quantity") {
loadChange(grid,e,"singleWeight");
loadChange(grid,e,"totalWeight");
}
if (e.field == "singleWeight") {
loadChange(grid,e,"totalWeight");
}
loadChange(grid,e,"id");
});
},
onSuccess: function (e) {
......
......@@ -59,7 +59,7 @@
<EF:EFColumn ename="thick" cname="厚(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="quantity" required="true" cname="数量"/>
<EF:EFColumn ename="singleWeight" required="true" format="{0:N3}" cname="单重(kg)"/>
<EF:EFColumn ename="totalWeight" cname="总重(kg)" required="true" format="{0:N3}"/>
<EF:EFColumn ename="totalWeight" cname="总重(kg)" required="true" format="{0:N3}" enable="false"/>
<EF:EFComboColumn cname="提交状态" ename="productStatus" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
......
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