Commit c095c529 by 宋祥

1.采购收货无法提交的BUG

parent dc90b620
...@@ -158,22 +158,22 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -158,22 +158,22 @@ public class ServiceHGCG002A extends ServiceBase {
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001A.updateStatus(fCg001A.getId(), HGConstant.CgPlanStatus.S_4); HGCGTools.HgCg001A.updateStatus(fCg001A.getId(), HGConstant.CgPlanStatus.S_4);
} }
//修改主表信息 // 修改主表信息
HGCGTools.HgCg002.updateCg002Pur(newCg002); HGCGTools.HgCg002.updateCg002Pur(newCg002);
} }
/**
* //获取采购计划明细
*
* @param fCg001A
* @param newCg002
*/
private void insertDetails(HGCG001A fCg001A, HGCG002 newCg002) { private void insertDetails(HGCG001A fCg001A, HGCG002 newCg002) {
//获取采购计划明细 HGCG002B cg002B = BeanUtils.copy(fCg001A, HGCG002B.class);
List<HGCG002B> cg002BList = new LinkedList<>();
HGCG002B cg002B = new HGCG002B();
//拷贝明细信息
BeanUtils.copyProperties(fCg001A, cg002B, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime");
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setPrimaryId(newCg002.getId()); cg002B.setPrimaryId(newCg002.getId());
cg002B.setPlanDetailId(fCg001A.getId()); cg002B.setPlanDetailId(fCg001A.getId());
cg002BList.add(cg002B); DaoUtils.insert(HGCG002B.INSERT, cg002B);
DaoUtils.insertBatch(HGCG002B.INSERT, cg002BList);
} }
/** /**
......
...@@ -266,7 +266,8 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -266,7 +266,8 @@ public class ServiceHGCG003 extends ServiceBase {
// 数据来源为合同的才需要更新合同状态 // 数据来源为合同的才需要更新合同状态
if (Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) { if (Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
HGCG002B dbCg002b = dbCg002BMap.get(fCg003B.getContractDetailId()); HGCG002B dbCg002b = dbCg002BMap.get(fCg003B.getContractDetailId());
HGCGTools.HgCg002B.updateReceive(dbCg002b, fCg003B.getReceiveQty().negate()); HGCGTools.HgCg002B.updateReceive(dbCg002b, fCg003B.getReceiveQty().negate(),
fCg003B.getReceiveWeight().negate());
} }
} }
} }
......
package com.baosight.hggp.hg.cg.service; package com.baosight.hggp.hg.cg.service;
import com.alibaba.fastjson.JSON;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
...@@ -125,9 +126,9 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -125,9 +126,9 @@ public class ServiceHGCG003A extends ServiceBase {
AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(), AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(), String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(),
fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty())); fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty()));
AssertUtils.isGt(fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight(), // AssertUtils.isGt(fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight(),
String.format("合同[%s]本次收货重量(%s)不能大于本次最大收货重量(%s)", cg001.getContractNo(), // String.format("合同[%s]本次收货重量(%s)不能大于本次最大收货重量(%s)", cg001.getContractNo(),
fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight())); // fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight()));
} }
} }
...@@ -182,10 +183,8 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -182,10 +183,8 @@ public class ServiceHGCG003A extends ServiceBase {
* @param cg002 * @param cg002
*/ */
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) { private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
HGCG002B hgcg002B = fCg002Bs.get(0); HGCG002B firstCg002B = fCg002Bs.get(0);
HGCG003 newCg003 = new HGCG003(); HGCG003 newCg003 = BeanUtils.copy(firstCg002B, HGCG003.class);
BeanUtils.copyProperties(hgcg002B, newCg003, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime");
newCg003.setReceiveDate(DateUtils.shortDate()); newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO)); newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
// 计算收获总数量 // 计算收获总数量
...@@ -230,10 +229,12 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -230,10 +229,12 @@ public class ServiceHGCG003A extends ServiceBase {
HGCG003B cg003B = new HGCG003B(); HGCG003B cg003B = new HGCG003B();
//拷贝主表明细信息 //拷贝主表明细信息
BeanUtils.copyProperties(newCg003, cg003B, "id"); BeanUtils.copyProperties(newCg003, cg003B, "id");
System.out.println("cg003B -> " + JSON.toJSONString(cg003B));
//拷贝明细信息 //拷贝明细信息
BeanUtils.copyProperties(fCg002B, cg003B, "id", "createdBy", "createdName", "createdTime", "updatedBy", BeanUtils.copyProperties(fCg002B, cg003B, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime", "contractNo", "planNo", "supCode", "supName", "purUserId", "updatedName", "updatedTime", "contractNo", "planNo", "supCode", "supName", "purUserId",
"purUserName", "status"); "purUserName", "status");
System.out.println("cg003B -> " + JSON.toJSONString(cg003B));
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg003B.setPrimaryId(newCg003.getId()); cg003B.setPrimaryId(newCg003.getId());
cg003B.setReceiveUnitWeight(fCg002B.getPurUnitWeight()); cg003B.setReceiveUnitWeight(fCg002B.getPurUnitWeight());
...@@ -243,7 +244,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -243,7 +244,7 @@ public class ServiceHGCG003A extends ServiceBase {
cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount()); cg003B.setUnCancelAmount(fCg002B.getTaxIncludeAmount());
DaoUtils.insert(HGCG003B.INSERT, cg003B); DaoUtils.insert(HGCG003B.INSERT, cg003B);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty()); HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty(), cg003B.getReceiveWeight());
} }
} }
...@@ -176,7 +176,8 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -176,7 +176,8 @@ public class ServiceHGCG003B extends ServiceBase {
// 计算差异数量,更新合同状态 // 计算差异数量,更新合同状态
HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003BMap.get(fCg003B.getId());
BigDecimal diffQty = fCg003B.getReceiveQty().subtract(dbCg003B.getReceiveQty()); BigDecimal diffQty = fCg003B.getReceiveQty().subtract(dbCg003B.getReceiveQty());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty); BigDecimal diffWeight = fCg003B.getReceiveWeight().subtract(dbCg003B.getReceiveWeight());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty, diffWeight);
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v) -> { dbCg002AMap.forEach((k, v) -> {
...@@ -292,7 +293,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -292,7 +293,7 @@ public class ServiceHGCG003B extends ServiceBase {
*/ */
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap, private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) { HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
//数据来源为合同的 // 数据来源为合同的
if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) { if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
...@@ -300,7 +301,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -300,7 +301,7 @@ public class ServiceHGCG003B extends ServiceBase {
DaoUtils.update(HGCG003B.DELETE, dbCg003B); DaoUtils.update(HGCG003B.DELETE, dbCg003B);
// 更新合同状态 // 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()),
dbCg003B.getReceiveQty().negate()); dbCg003B.getReceiveQty().negate(), dbCg003B.getReceiveWeight().negate());
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v) -> { dbCg002AMap.forEach((k, v) -> {
......
...@@ -566,14 +566,15 @@ public class HGCGTools { ...@@ -566,14 +566,15 @@ public class HGCGTools {
* @param dbCg002B * @param dbCg002B
* @param receiveQty * @param receiveQty
*/ */
public static void updateReceive(HGCG002B dbCg002B, BigDecimal receiveQty) { public static void updateReceive(HGCG002B dbCg002B, BigDecimal receiveQty, BigDecimal receiveWeight) {
AssertUtils.isNull(dbCg002B, "合同明细不能为空!"); AssertUtils.isNull(dbCg002B, "合同明细不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!"); AssertUtils.isNull(receiveQty, "收货数量不能为空!");
BigDecimal newReceiveQty = receiveQty.add(dbCg002B.getReceiveQty()); BigDecimal newReceiveQty = receiveQty.add(dbCg002B.getReceiveQty());
BigDecimal newReceiveWeight = receiveWeight.add(dbCg002B.getReceiveWeight());
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId()); paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty); paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight())); paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveWeight);
if (newReceiveQty.compareTo(BigDecimal.ZERO) == 0) { if (newReceiveQty.compareTo(BigDecimal.ZERO) == 0) {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_2); paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_2);
} else if (dbCg002B.getPurQty().compareTo(newReceiveQty) == 0) { } else if (dbCg002B.getPurQty().compareTo(newReceiveQty) == 0) {
......
...@@ -116,10 +116,10 @@ let confirm = function () { ...@@ -116,10 +116,10 @@ let confirm = function () {
message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量"); message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量");
return; return;
} }
if (!isBlank(bcReceiveWeight) && parseFloat(bcReceiveWeight) > parseFloat(bcMaxReceiveWeight)) { // if (!isBlank(bcReceiveWeight) && parseFloat(bcReceiveWeight) > parseFloat(bcMaxReceiveWeight)) {
message("勾选的第" + (i + 1) + "行本次收货重量不能大于本次最大收货重量"); // message("勾选的第" + (i + 1) + "行本次收货重量不能大于本次最大收货重量");
return; // return;
} // }
} }
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", { JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", {
ok: function () { ok: function () {
......
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