Commit a5e613e5 by liuyang

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

parents 6aef0330 fca70dd0
package com.baosight.hggp.hg.cg.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.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -20,10 +18,10 @@ import java.util.Map;
* @history 2024-05-09 15:41:54 create
*/
public class HGCG002A extends HGCG002 {
public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/
public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
private BigDecimal bcMaxReceiveQty = new BigDecimal(0.000); /* 本次最大收货数量*/
......@@ -32,14 +30,14 @@ public class HGCG002A extends HGCG002 {
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_BC_RECEIVE_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次收货数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BC_MAX_RECEIVE_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
......@@ -56,23 +54,23 @@ public class HGCG002A extends HGCG002 {
super.initMetaData();
initMetaData();
}
public BigDecimal getBcReceiveQty() {
return bcReceiveQty;
}
public void setBcReceiveQty(BigDecimal bcReceiveQty) {
this.bcReceiveQty = bcReceiveQty;
}
public BigDecimal getBcMaxReceiveQty() {
return bcMaxReceiveQty;
}
public void setBcMaxReceiveQty(BigDecimal bcMaxReceiveQty) {
this.bcMaxReceiveQty = bcMaxReceiveQty;
}
/**
* get the value from Map.
*
......@@ -83,7 +81,7 @@ public class HGCG002A extends HGCG002 {
super.fromMap(map);
setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty));
setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty));
}
/**
......
......@@ -32,7 +32,7 @@ import java.util.Map;
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003A extends ServiceBase {
/**
* 画面初始化
*
......@@ -53,7 +53,7 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 查询操作
*
......@@ -74,7 +74,7 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 确认操作.
*
......@@ -99,7 +99,7 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 数据校验
*
......@@ -119,7 +119,7 @@ public class ServiceHGCG003A extends ServiceBase {
fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty()));
}
}
/**
* 数据保存
*
......@@ -143,5 +143,5 @@ public class ServiceHGCG003A extends ServiceBase {
HGCGTools.HgCg002.updateReceive(dbCg002A, fCg002A.getBcReceiveQty());
}
}
}
......@@ -37,6 +37,11 @@
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount", <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT as "taxIncludeAmount", <!-- 含税金额 -->
TAX_AMOUNT as "taxAmount", <!-- 税额 -->
TAX_RATE as "taxRate", <!-- 税率 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
......@@ -187,13 +192,19 @@
PUR_QTY, <!-- 采购数量 -->
PUR_UNIT_WEIGHT, <!-- 采购单重 -->
PUR_WEIGHT, <!-- 采购重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
STATUS, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT, <!-- 含税金额 -->
TAX_AMOUNT, <!-- 税额 -->
TAX_RATE <!-- 税率 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #contractDate#, #contractNo#, #planNo#,
#supCode#, #supName#, #purUserId#, #purUserName#, #inventCode#, #inventName#,
#specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
#purQty#, #purUnitWeight#, #purWeight#, #status#
#purQty#, #purUnitWeight#, #purWeight#, #status#,
#price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#
)
</insert>
......@@ -221,6 +232,11 @@
SUP_NAME = #supName#, <!-- 供应商名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
TAX_RATE = #taxRate#, <!-- 税率 -->
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
......
......@@ -38,6 +38,8 @@
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_UNIT_WEIGHT as "receiveUnitWeight", <!-- 收货单重 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount", <!-- 金额 -->
STATUS as "status" <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
</sql>
......@@ -94,6 +96,12 @@
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="price">
PRICE = #price#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
</sql>
<sql id="idCondition">
......@@ -175,6 +183,8 @@
RECEIVE_QTY, <!-- 收货数量 -->
RECEIVE_UNIT_WEIGHT, <!-- 收货单重 -->
RECEIVE_WEIGHT, <!-- 收货重量 -->
PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 -->
STATUS <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
......@@ -182,7 +192,7 @@
#planNo#, #contractNo#, #supCode#, #supName#, #purUserId#, #purUserName#,
#inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#,
#unit#, #length#, #width#, #thick#, #receiveQty#, #receiveUnitWeight#,
#receiveWeight#, #status#
#receiveWeight#,#price#, #amount#, #status#
)
</insert>
......
......@@ -57,7 +57,8 @@ public class HGKC001 extends DaoEPBase {
public static final String FIELD_SUBMIT_STATUS = "submitStatus"; /* 提交状态 0未提交,1已提交*/
public static final String FIELD_STORAGE_TYPE = "storageType"; /* 入库类型:1:入库 2:退回*/
public static final String FIELD_IS_RETURN = "isReturn"; /* 是否退回*/
public static final String FIELD_PRICE = "price"; /* 单价*/
public static final String FIELD_AMOUNT = "amount"; /* 金额*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -95,6 +96,8 @@ public class HGKC001 extends DaoEPBase {
public static final String COL_SUBMIT_STATUS = "SUBMIT_STATUS"; /* 提交状态 0未提交,1已提交*/
public static final String COL_STORAGE_TYPE = "STORAGE_TYPE"; /* 入库类型:1:入库 2:退回*/
public static final String COL_IS_RETURN = "IS_RETURN"; /* 是否退回*/
public static final String COL_PRICE = "PRICE"; /* 单价*/
public static final String COL_AMOUNT = "AMOUNT"; /* 金额*/
public static final String QUERY = "HGKC001.query";
......@@ -141,6 +144,8 @@ public class HGKC001 extends DaoEPBase {
private Integer submitStatus; /* 提交状态 0未提交,1已提交*/
private Integer storageType; /* 入库类型:1:入库 2:退回*/
private Integer isReturn; /* 是否退回:0:否 1:是*/
private BigDecimal price = new BigDecimal(0.000); /* 单价*/
private BigDecimal amount = new BigDecimal(0.000); /* 金额*/
/**
* initialize the metadata.
......@@ -306,6 +311,20 @@ public class HGKC001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_IS_RETURN);
eiColumn.setDescName("是否退回:0:否 1:是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRICE);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("单价");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("金额");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -852,6 +871,22 @@ public class HGKC001 extends DaoEPBase {
this.isReturn = isReturn;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
/**
* get the value from Map.
*
......@@ -895,6 +930,8 @@ public class HGKC001 extends DaoEPBase {
setSubmitStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SUBMIT_STATUS)), submitStatus));
setStorageType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STORAGE_TYPE)), storageType));
setIsReturn(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_RETURN)), isReturn));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
}
/**
......@@ -939,6 +976,8 @@ public class HGKC001 extends DaoEPBase {
map.put(FIELD_SUBMIT_STATUS, StringUtils.toString(submitStatus, eiMetadata.getMeta(FIELD_SUBMIT_STATUS)));
map.put(FIELD_STORAGE_TYPE, StringUtils.toString(storageType, eiMetadata.getMeta(FIELD_STORAGE_TYPE)));
map.put(FIELD_IS_RETURN, StringUtils.toString(isReturn, eiMetadata.getMeta(FIELD_IS_RETURN)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
return map;
}
......
......@@ -37,6 +37,8 @@
DEPOSIT_WEIGHT as "depositWeight", <!-- 入库重量 -->
STORAGE_TYPE as "storageType", <!-- 入库类型:1:入库 2:退回 -->
IS_RETURN as "isReturn", <!-- 是否退回:0:否 1:是 -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount", <!-- 金额 -->
SUBMIT_STATUS as "submitStatus" <!-- 提交状态 -->
</sql>
......@@ -105,6 +107,12 @@
<isNotEmpty prepend=" AND " property="storageType">
STORAGE_TYPE = #storageType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="price">
PRICE = #price#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
</sql>
<sql id="idCondition">
......@@ -188,6 +196,8 @@
DEPOSIT_WEIGHT, <!-- 入库重量 -->
STORAGE_TYPE, <!-- 入库类型:1:入库 2:退回 -->
IS_RETURN, <!-- 是否退回:0:否 1:是 -->
PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 -->
SUBMIT_STATUS
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
......@@ -195,7 +205,7 @@
#receiveNo#, #planNo#, #contractNo#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #specId#, #spec#, #material#,
#unit#, #length#, #width#, #thick#, #depositQty#, #depositUnitWeight#, #depositWeight#,
#storageType#, #isReturn#,#submitStatus#
#storageType#, #isReturn#,#price#, #amount#,#submitStatus#
)
</insert>
......
......@@ -214,7 +214,7 @@ public class HGKCTools {
Map<String, Object> paramMap = new HashMap();
paramMap.put("qualityId", qualityId);
paramMap.put("deleteFlag", 0);
paramMap.put("submitStatus", HGConstant.ProductStatus.YTJ);
paramMap.put("submitStatus", HGConstant.ProductStatus.WTJ);
List<HGKC003> list = DaoBase.getInstance().query(HGKC003.QUERY, paramMap);
AssertUtils.isEmpty(list, "生产入库单为空!");
return CollectionUtils.isEmpty(list) ? null : list;
......
......@@ -5,20 +5,20 @@
Version : 1.0
schema : hggp
tableName : HGPZ005A
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
PROCESS_CODE VARCHAR NOT NULL,
PROCESS_NAME VARCHAR NOT NULL,
COMPOSING_COEFF VARCHAR,
UNIT_COEFF VARCHAR,
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
PROCESS_CODE VARCHAR NOT NULL,
PROCESS_NAME VARCHAR NOT NULL,
COMPOSING_COEFF VARCHAR,
UNIT_COEFF VARCHAR,
PARENT_ID BIGINT
-->
<sqlMap namespace="HGPZ005A">
......@@ -85,6 +85,9 @@
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -633,6 +633,20 @@ public class HGPZTools {
/**
* 通过存货编码查询存货工序*
*
* @param inventCodes
* @return
*/
public static List<HGPZ005A> queryByInventCodes(List<String> inventCodes) {
AssertUtils.isTrue(inventCodes.isEmpty(), "存货编码不能为空!");
Map paramMap = new HashMap();
paramMap.put("inventCodes", inventCodes);
List<HGPZ005A> results = DaoBase.getInstance().query(HGPZ005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* 通过存货编码查询存货工序*
*
* @param ids
* @return
*/
......
......@@ -321,6 +321,7 @@ public class ServiceHGSC004A extends ServiceBase {
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
List<HGSC005A> hgsc005AList = new LinkedList<>();
for(HGSC004A hgsc004A : hgsc004AList){
//子表
HGSC005A hgsc005a = new HGSC005A();
......@@ -332,7 +333,10 @@ public class ServiceHGSC004A extends ServiceBase {
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.save(hgsc005a);
hgsc005AList.add(hgsc005a);
}
if(hgsc005AList != null && !hgsc005AList.isEmpty()){
HGSCTools.THGSC005A.saveList(hgsc005AList);
}
}
......
......@@ -4,23 +4,23 @@
Version : 1.0
schema : hggp
tableName : HGSC005
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
commit_status TINYINT,
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
commit_status TINYINT,
finish_date VARCHAR,
account_code VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
account_code VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap namespace="HGSC005">
......@@ -85,12 +85,15 @@
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matIds">
mat_id NOT IN <iterate close=")" open="(" conjunction="," property="matIds">#matIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC005">
SELECT
id as "id",
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
......
......@@ -151,6 +151,9 @@
<isNotEmpty prepend=" AND " property="planCodes">
plan_code IN <iterate close=")" open="(" conjunction="," property="planCodes">#planCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCodes">
product_code IN <iterate close=")" open="(" conjunction="," property="productCodes">#productCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -409,6 +409,26 @@ public class HGSCTools {
return CollectionUtils.isEmpty(results) ? null : results;
}
private static List<HGSC005A> generatorNewPlanDetail(List<HGSC005A> hgsc005aList){
List<String> inventCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).collect(Collectors.toList());
//通过存货档案编码查询存货档案工序
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCodes(inventCodes);
List<HGSC005A> hgsc005AList = new ArrayList<>();
hgsc005aList.forEach(hgsc005a->{
List<HGPZ005A> filterHgpz005a = hgpz005AList.stream().filter(o->o.getInventCode().equals(hgsc005a.getProductCode())).collect(Collectors.toList());
AssertUtils.isEmpty(filterHgpz005a, String.format("产品[%s]工序不存在,请先到存货档案配置产品工序!",hgsc005a.getProductName()));
filterHgpz005a.forEach(pz -> {
HGSC005A obj = new HGSC005A();
BeanUtils.copyProperties(hgsc005a,obj);
obj.setInventProcessId(pz.getId());
obj.setProcessCode(pz.getProcessCode());
obj.setProcessName(pz.getProcessName());
obj.setProcessOrder(pz.getProcessOrder());
hgsc005AList.add(obj);
});
});
return hgsc005AList;
}
private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){
//通过存货档案编码查询存货档案工序
......@@ -427,6 +447,37 @@ public class HGSCTools {
return hgsc005AList;
}
private static Map<Long,Optional<HGSC005A>> queryOldPlanDetail(List<HGSC005A> hgsc005aList){
List<String> productCodes = hgsc005aList.stream().map(HGSC005A::getProductCode).collect(Collectors.toList());
Map paramMap = new HashMap();
//因为提交时肯定matid相同,直接取第一个即可
paramMap.put(HGSC005A.FIELD_mat_id, hgsc005aList.get(0).getMatId());
paramMap.put("productCodes", productCodes);
List<HGSC005A> oldObjList = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
Map<Long,Optional<HGSC005A>> returnOldObjMap = new LinkedHashMap<>();
hgsc005aList.forEach(hgsc005a->{
//构建计划物料明细ID唯一
if(hgsc005a.getProductType().compareTo(ProductTypeEnum.STRUCT.getCode())==0){
List<HGSC005A> oldObjFilterList = oldObjList.stream().filter(o->o.getProductCode().equals(hgsc005a.getProductCode())
&& o.getMatDetailId().compareTo(hgsc005a.getMatDetailId())==0)
.collect(Collectors.toList());
Map<Long,Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId,Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity))));
returnOldObjMap.putAll(oldObjMap);
}else{
List<HGSC005A> oldObjFilterList = oldObjList.stream().filter(o->o.getProductCode().equals(hgsc005a.getProductCode()))
.collect(Collectors.toList());
Map<Long,Optional<HGSC005A>> oldObjMap = Optional.ofNullable(oldObjFilterList).orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(HGSC005A::getInventProcessId,Collectors.maxBy(
Comparator.comparingInt(HGSC005A::getQuantity))));
oldObjMap.putAll(oldObjMap);
}
});
return returnOldObjMap;
}
private static Map<Long,Optional<HGSC005A>> queryOldPlanDetail(HGSC005A hgsc005a){
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_mat_id, hgsc005a.getMatId());
......@@ -442,6 +493,36 @@ public class HGSCTools {
return oldObjMap;
}
public static List<HGSC005A> saveList(List<HGSC005A> hgsc005aList){
checkUpdateData(hgsc005aList);
constructObj(hgsc005aList);
List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005aList);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005aList);
List<HGSC005A> createList = new ArrayList<>();
List<HGSC005A> updateList = new ArrayList<>();
hgsc005AList.forEach(o -> {
Optional<HGSC005A> op = oldObjMap.get(o.getInventProcessId());
if(Objects.nonNull(op)){
HGSC005A uo = op.get();
uo.setQuantity(uo.getQuantity()+o.getQuantity());
uo.setUnfinishQuantity(uo.getUnfinishQuantity()+o.getQuantity());
handleWeight(o,uo);
updateList.add(uo);
}else{
handleWeight(o,o);
createList.add(o);
}
});
if(CollectionUtils.isNotEmpty(createList)){
DaoUtils.insertBatch(HGSC005A.INSERT,createList);
}
if(CollectionUtils.isNotEmpty(updateList)){
DaoUtils.updateBatch(HGSC005A.UPDATE,updateList);
}
return hgsc005aList;
}
public static HGSC005A save(HGSC005A hgsc005a){
checkUpdateData(hgsc005a);
constructObj(hgsc005a);
......@@ -550,6 +631,40 @@ public class HGSCTools {
/**
* 校验修改的数据
*
* @param hgsc005aList
*/
private static void checkUpdateData(List<HGSC005A> hgsc005aList) {
for(HGSC005A hgsc005a : hgsc005aList){
AssertUtils.isTrue(Objects.isNull(hgsc005a.getMatId())||hgsc005a.getMatId()<=0, "物料清单ID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getMatDetailId())||hgsc005a.getMatDetailId()<=0, "物料清单明细ID不能为空!");
AssertUtils.isEmpty(hgsc005a.getProductCode(), "产品编码不能为空!");
AssertUtils.isEmpty(hgsc005a.getProductName(), "产品名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getTechFlowId())||hgsc005a.getTechFlowId()<=0, "工艺流程ID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getQuantity())||hgsc005a.getQuantity()<=0, "数量不能为空!");
}
}
public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList){
HGSC005 hgsc005 = THGSC005.queryByMatId(hgsc005aList.get(0).getMatId());
hgsc005aList.forEach(hgsc005a -> {
hgsc005a.setPlanCode(hgsc005.getPlanCode());
hgsc005a.setCompanyCode(hgsc005.getCompanyCode());
hgsc005a.setCompanyName(hgsc005.getCompanyName());
hgsc005a.setDepCode(hgsc005.getDepCode());
hgsc005a.setDepName(hgsc005.getDepName());
hgsc005a.setProjCode(hgsc005.getProjCode());
hgsc005a.setProjName(hgsc005.getProjName());
hgsc005a.setFinishDate(hgsc005.getFinishDate());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setFinishQuantity(0);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
});
return hgsc005aList;
}
/**
* 校验修改的数据
*
* @param hgsc005a
*/
private static void checkUpdateData(HGSC005A hgsc005a) {
......@@ -561,6 +676,23 @@ public class HGSCTools {
AssertUtils.isTrue(Objects.isNull(hgsc005a.getQuantity())||hgsc005a.getQuantity()<=0, "数量不能为空!");
}
public static List<HGSC005A> constructObj(List<HGSC005A> hgsc005aList,HGSC005 hgsc005){
hgsc005aList.forEach(hgsc005a->{
hgsc005a.setPlanCode(hgsc005.getPlanCode());
hgsc005a.setCompanyCode(hgsc005.getCompanyCode());
hgsc005a.setCompanyName(hgsc005.getCompanyName());
hgsc005a.setDepCode(hgsc005.getDepCode());
hgsc005a.setDepName(hgsc005.getDepName());
hgsc005a.setProjCode(hgsc005.getProjCode());
hgsc005a.setProjName(hgsc005.getProjName());
hgsc005a.setFinishDate(hgsc005.getFinishDate());
hgsc005a.setUnfinishQuantity(hgsc005a.getQuantity());
hgsc005a.setFinishQuantity(0);
hgsc005a.setUnfinishWeight(hgsc005a.getTotalWeight());
});
return hgsc005aList;
}
public static HGSC005A constructObj(HGSC005A hgsc005a){
HGSC005 hgsc005 = THGSC005.queryByMatId(hgsc005a.getMatId());
hgsc005a.setPlanCode(hgsc005.getPlanCode());
......
......@@ -14,6 +14,37 @@ $(function () {
// change事件
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
var item = e.items[0];
if (e.field == "price") {
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//税额
let taxAmount = totalAmount* item.taxRate / 100;
//不含税金额
let amount = totalAmount - taxAmount;
//含税金额
let taxIncludeAmount = amount + taxAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}
if (e.field == "taxRate") {
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//税额
let taxAmount = totalAmount* item.taxRate / 100;
//不含税金额
let amount = totalAmount - taxAmount;
//含税金额
let taxIncludeAmount = amount + taxAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}
});
},
onSave: function (e) {
......
......@@ -65,9 +65,14 @@
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" enable="false"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="taxRate" cname="税率(%)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
......@@ -65,6 +65,8 @@
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
......@@ -70,6 +70,11 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="taxRate" cname="税率(%)" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
......@@ -69,6 +69,8 @@
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
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