Commit 9689b245 by 江和松

合同名字增加状态,随收货、入库质检单变动

parent 71b7d1c8
......@@ -170,9 +170,6 @@ public class ServiceHGCG002A extends ServiceBase {
cg002B.setPlanDetailId(dbCg001A.getId());
cg002BList.add(cg002B);
DaoUtils.insertBatch(HGCG002B.INSERT,cg002BList);
//修改主表信息
HGCGTools.HgCg002.updateCg002Pur(newCg002);
}
/**
......
......@@ -128,7 +128,8 @@ public class ServiceHGCG003A extends ServiceBase {
*/
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
HGCG002B hgcg002B = fCg002Bs.get(0);
HGCG003 newCg003 = BeanUtils.copy(hgcg002B, HGCG003.class);
HGCG003 newCg003 = new HGCG003();
BeanUtils.copyProperties(hgcg002B, newCg003,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
......@@ -164,6 +165,10 @@ public class ServiceHGCG003A extends ServiceBase {
cg003B.setContractDetailId(dbCg002B.getId());
DaoUtils.insert(HGCG003B.INSERT,cg003B);
BigDecimal diffQty = cg003B.getReceiveQty().subtract(dbCg002B.getReceiveQty());
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
dbCg002B.setStatus(status);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002B, cg003B.getReceiveQty());
}
......
......@@ -126,6 +126,9 @@
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO = #contractNo#
</isNotEmpty>
......@@ -252,6 +255,8 @@
AMOUNT = #amount#, <!-- 金额(不含税金额) -->
TAX_INCLUDE_AMOUNT = #taxIncludeAmount#, <!-- 含税金额 -->
TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
PUR_QTY = #purQty#,
PUR_WEIGHT = #purWeight#,
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
......@@ -293,4 +298,15 @@
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCG002
</select>
<!-- 入库质检修改收货 -->
<update id="updateCheck">
UPDATE ${hggpSchema}.HGCG002
SET
RECEIVE_QTY = #receiveQty#,
RECEIVE_WEIGHT = #receiveWeight#,
STATUS = #status#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
......@@ -379,10 +379,10 @@
b.PUR_USER_NAME = #purUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="statuses">
b.STATUS IN <iterate open="(" close=")" conjunction="," property="statuses">#statuses[]#</iterate>
a.STATUS IN <iterate open="(" close=")" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
b.STATUS = #status#
a.STATUS = #status#
</isNotEmpty>
<include refid="idCondition"/>
<dynamic prepend="ORDER BY">
......@@ -401,8 +401,21 @@
SET
RECEIVE_QTY = #receiveQty#,
RECEIVE_WEIGHT = #receiveWeight#,
STATUS = #status#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 入库质检修改收货 -->
<update id="updateCheck">
UPDATE ${hggpSchema}.HGCG002A
SET
RECEIVE_QTY = #receiveQty#,
RECEIVE_WEIGHT = #receiveWeight#,
STATUS = #status#,
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
......@@ -249,6 +249,23 @@
WHERE RECEIVE_NO = #receiveNo#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGCG003
SET
ID = #id#,
SUP_CODE = #supCode#, <!-- 供应商编码 -->
SUP_NAME = #supName#, <!-- 供应商名称 -->
PUR_USER_ID = #purUserId#, <!-- 采购员 -->
PUR_USER_NAME = #purUserName#, <!-- 采购员名称 -->
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
AMOUNT = #amount#, <!-- 金额 -->
RECEIVE_DATE = REPLACE(#receiveDate#, '-', ''), <!-- 收货日期 -->
<include refid="updateRevise"/>
WHERE
ID = #id#
</update>
<!-- 修改数量 -->
<update id="updateQty">
UPDATE ${hggpSchema}.HGCG003
......
......@@ -15,6 +15,7 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
......@@ -311,6 +312,19 @@ public class HGCGTools {
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGCG002> listByIds(List<Long> ids) {
AssertUtils.isEmpty(ids, "合同号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
}
/**
* 查询
*
* @param contractNos
* @return
*/
......@@ -319,10 +333,10 @@ public class HGCGTools {
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
}
public static void updateContractPrimary(List<HGCG002> hgcg002AList) {
List<Long> primaryIds = hgcg002AList.stream().map(o->o.getId()).collect(Collectors.toList());
public static void updateContractPrimary(List<HGCG002> hgcg002List) {
List<Long> primaryIds = hgcg002List.stream().map(o->o.getId()).collect(Collectors.toList());
List<HGCG002B> queryHgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds);
hgcg002AList.forEach(cg002 ->{
hgcg002List.forEach(cg002 ->{
List<HGCG002B> hgcg002BList = queryHgcg002BList.stream().filter(o->o.getPrimaryId().compareTo(cg002.getId()) == 0).collect(Collectors.toList());
//修改主表信息
//采购数量
......@@ -389,6 +403,55 @@ public class HGCGTools {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
}
public static void updateChecks(List<HGZL001> fZl001s) {
//获取收货明细数据
List<Long> receiveDetailIds = fZl001s.stream().map(HGZL001::getReceiveDetailId).collect(Collectors.toList());
List<HGCG003B> hgcg003BList = HGCGTools.HgCg003B.list(receiveDetailIds);
//获取合同明细
List<Long> contractDetailIds = hgcg003BList.stream().map(HGCG003B::getContractDetailId).collect(Collectors.toList());
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.list(contractDetailIds);
//合同主表信息
List<Long> contractIds = hgcg002BList.stream().map(o->o.getPrimaryId()).collect(Collectors.toList());
List<HGCG002> queryHgcg002List = HGCGTools.HgCg002.listByIds(contractIds);
fZl001s.forEach(hgzl001 ->{
//关联获取到收货明细
HGCG003B hgcg003B = hgcg003BList.stream().filter(o -> o.getId().compareTo(hgzl001.getReceiveDetailId()) == 0).findAny().orElse(null);
if(Objects.nonNull(hgcg003B)){
//关联获取到合同明细
HGCG002B hgcg002B = hgcg002BList.stream().filter(o->o.getId().compareTo(hgcg003B.getContractDetailId()) == 0).findAny().orElse(null);
if(Objects.nonNull(hgcg002B)){
BigDecimal unqualifyQty = hgzl001.getUnqualifyQty();
Integer status = unqualifyQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
hgcg002B.setStatus(status);
HGCGTools.HgCg002B.updateCheck(hgcg002B,unqualifyQty.negate());
//修改主表信息
HGCG002 hgcg002 = queryHgcg002List.stream().filter(o->o.getId().compareTo(hgcg002B.getPrimaryId()) == 0).findAny().orElse(null);
hgcg002.setStatus(status);
HGCGTools.HgCg002.updateCheck(hgcg002,unqualifyQty.negate());
}
}
});
}
/**
* 修改状态
*
* @param dbCg002
* @param checkQty
*/
public static void updateCheck(HGCG002 dbCg002, BigDecimal checkQty) {
AssertUtils.isNull(dbCg002, "合同不能为空!");
BigDecimal newReceiveQty = checkQty.add(dbCg002.getReceiveQty());
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_ID, dbCg002.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002.getStatus());
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_CHECK, paramMap);
}
}
/**
......@@ -493,9 +556,28 @@ public class HGCGTools {
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002B.getStatus());
DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_RECEIVE, paramMap);
}
/**
* 修改状态
*
* @param dbCg002B
* @param receiveQty
*/
public static void updateCheck(HGCG002B dbCg002B, BigDecimal receiveQty) {
AssertUtils.isNull(dbCg002B, "合同明细不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!");
BigDecimal newReceiveQty = receiveQty.add(dbCg002B.getReceiveQty());
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002B.getStatus());
DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_CHECK, paramMap);
}
}
/**
......
......@@ -65,6 +65,8 @@ public class HGSqlConstant {
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
// 修改收货数量
public static final String UPDATE_RECEIVE = MODULE_NAME + "updateReceive";
// 入库质检修改收货数量
public static final String UPDATE_CHECK = MODULE_NAME + "updateCheck";
}
/**
......@@ -81,6 +83,8 @@ public class HGSqlConstant {
public static final String LOCK = MODULE_NAME + "lock";
// 修改收货数量
public static final String UPDATE_RECEIVE = MODULE_NAME + "updateReceive";
// 入库质检修改收货数量
public static final String UPDATE_CHECK = MODULE_NAME + "updateCheck";
}
/**
......
......@@ -129,7 +129,8 @@ public class ServiceHGKC001A extends ServiceBase {
for (HGCG003A fCg003A : fCg003As) {
String receiveNo = fCg003A.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
HGKC001 newKc001 = BeanUtils.copy(dbCg003, HGKC001.class);
HGKC001 newKc001 = new HGKC001();
BeanUtils.copyProperties(dbCg003, newKc001,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newKc001.setWhCode(fCg003A.getWhCode());
newKc001.setWhName(fCg003A.getWhName());
newKc001.setDepositDate(DateUtils.shortDate());
......
......@@ -124,7 +124,9 @@ public class ServiceHGKC002 extends ServiceBase {
DaoUtils.update(HGKC002.DELETE, fKc002);
// 生成红冲记录
HGKC002 dbKc002 = dbKc002Map.get(fKc002.getReqNo());
HGKC002 newKc002 = BeanUtils.copy(dbKc002, HGKC002.class);
HGKC002 newKc002 = new HGKC002();
BeanUtils.copyProperties(dbKc002, newKc002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newKc002.setReqNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROD_REQ_NO));
newKc002.setApplyQty(dbKc002.getApplyQty().negate());
newKc002.setApplyWeight(dbKc002.getApplyWeight().negate());
......
......@@ -126,7 +126,8 @@ public class ServiceHGKC002A extends ServiceEPBase {
BigDecimal applyQty = fKc010a.getApplyQty();
Long invId = fKc010a.getId();
HGKC010A dbKc010 = dbKc010Map.get(invId);
HGKC002 newKc002 = BeanUtils.copy(dbKc010, HGKC002.class);
HGKC002 newKc002 = new HGKC002();
BeanUtils.copyProperties(dbKc010, newKc002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newKc002.setReqNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROD_REQ_NO));
newKc002.setReceiptDate(DateUtils.shortDate());
newKc002.setApplyQty(applyQty);
......
......@@ -238,7 +238,8 @@ public class ServiceHGKC003 extends ServiceBase {
*/
private void sendBackOption(HGKC003 fKc003) {
// 生产一条负数量和产量的红冲记录
HGKC003 newKc003 = BeanUtils.copy(fKc003, HGKC003.class);
HGKC003 newKc003 = new HGKC003();
BeanUtils.copyProperties(fKc003,newKc003,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newKc003.setInvQty(fKc003.getInvQty().negate());
newKc003.setInvWeight(fKc003.getInvWeight().negate());
newKc003.setDepositNoOld(fKc003.getDepositNo());
......
......@@ -207,7 +207,8 @@ public class ServiceHGKC009 extends ServiceBase {
for (Map.Entry<String, HGKC010> entry : endKcs.entrySet()) {
String key = entry.getKey();
HGKC010 endKc = entry.getValue();
HGKC009 kc009 = BeanUtils.copy(endKc, HGKC009.class);
HGKC009 kc009 = new HGKC009();
BeanUtils.copyProperties(endKc, kc009,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
kc009.setInventRecordId(endKc.getSpecId());
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
......
......@@ -111,7 +111,8 @@ public class HGKCTools {
// db数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetData(receiveIDsList);
HGCG003B dbCg003B = dbCg003BMap.get(receiveId);
HGKC001 newKc001 = BeanUtils.copy(dbCg003B, HGKC001.class);
HGKC001 newKc001 = new HGKC001();
BeanUtils.copyProperties(dbCg003B, newKc001,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newKc001.setDepositDate(DateUtils.shortDate());
newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO));
newKc001.setDepositQty(dbCg003B.getDepositQty());
......
......@@ -230,7 +230,7 @@ public class ServiceHGSC009A extends ServiceBase {
}
}
// 数据校验
this.checkInsertcgData(hgsc009AList);
this.checkInsertcgData(hgsc009List);
Map<String,List<HGSC009A>> sc009Map = hgsc009AList.stream().collect(Collectors.groupingBy(HGSC009A::getPlanMaterialCode));
Map<String, HGPZ005> finalPz005Map = pz005Map;
Optional.ofNullable(sc009Map).orElse(new HashMap<>()).forEach((k, v)->{
......@@ -277,10 +277,10 @@ public class ServiceHGSC009A extends ServiceBase {
return inInfo;
}
private void checkInsertcgData(List<HGSC009A> hgsc009AList) {
List<Long> materialPlanIds = hgsc009AList.stream().map(HGSC009A::getId).collect(Collectors.toList());
private void checkInsertcgData(List<HGSC009> hgsc009List) {
List<Long> materialPlanIds = hgsc009List.stream().map(HGSC009::getId).collect(Collectors.toList());
List<HGCG001> hgcg001List = HGCGTools.HgCg001.listByMaterialPlanIds(materialPlanIds);
hgsc009AList.forEach(o->{
hgsc009List.forEach(o->{
HGCG001 hgcg001 = hgcg001List.stream().filter(c -> c.getMaterialPlanId().intValue() == o.getId()).findAny().orElse(null);
AssertUtils.isTrue(Objects.nonNull(hgcg001), String.format("材料计划[%s]已生成采购计划", o.getPlanMaterialCode()));
});
......
......@@ -247,6 +247,9 @@ public class ServiceHGZL001 extends ServiceBase {
}
// 更新收货单状态
HGCGTools.HgCg003.updateChecks(fZl001s);
// 质检修改合同状态
HGCGTools.HgCg002.updateChecks(fZl001s);
}
}
......@@ -124,7 +124,8 @@ public class ServiceHGZL001B extends ServiceEPBase {
for (HGCG003B fCg003B : fCg003Bs) {
// 生成新数据
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
HGZL001 newZl001 = BeanUtils.copy(dbCg003B, HGZL001.class);
HGZL001 newZl001 = new HGZL001();
BeanUtils.copyProperties(dbCg003B, newZl001,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newZl001.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HPZL001_NUMBER));
newZl001.setReceiptDate(DateUtils.shortDate());
newZl001.setStatus(CommonConstant.YesNo.NO_0);
......
......@@ -82,7 +82,22 @@ $(function () {
let item = e.model;
//只有合同生成的不能编辑
if(item.source === '0'){
e.preventDefault();
//选择收货的指定列可以修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
if (e.sender.columns[i]["name"] === "companyCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "supCode") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
if (e.sender.columns[i]["name"] === "purUserName") {
e.sender.columns[i]["enable"] = false;
e.sender.columns[i]["readonly"] = true;
}
}
}
},
loadComplete: function (grid) {
......
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