Commit 51730006 by liuyang

2024-10-24 添加打包单及其功能

parent f3f747f1
...@@ -8,10 +8,7 @@ import com.baosight.hggp.core.security.UserSessionUtils; ...@@ -8,10 +8,7 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC004; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.domain.HGKC004A;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC016A;
import com.baosight.hggp.hg.kc.tools.HGKCTools; import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -185,12 +182,17 @@ public class ServiceHGKC004 extends ServiceEPBase { ...@@ -185,12 +182,17 @@ public class ServiceHGKC004 extends ServiceEPBase {
if (hgkc004A.getSource() == 2){ if (hgkc004A.getSource() == 2){
List<HGKC016A> hgkc016as1 = Optional.ofNullable(hgkc016as).orElse(new ArrayList<>()).stream().filter(hgkc016a -> hgkc016a.getId().equals(hgkc004A.getSourceId())).collect(Collectors.toList()); List<HGKC016A> hgkc016as1 = Optional.ofNullable(hgkc016as).orElse(new ArrayList<>()).stream().filter(hgkc016a -> hgkc016a.getId().equals(hgkc004A.getSourceId())).collect(Collectors.toList());
AssertUtils.isEmpty(hgkc016as1, "打包单明细库存不存在,无法保存!"); AssertUtils.isEmpty(hgkc016as1, "打包单明细库存不存在,无法保存!");
for (HGKC016A hgkc016a: hgkc016as1) {
hgkc016as1.forEach(hgkc016a -> { HGKC016 hgkc016 = HGKCTools.HgKc016.getById(hgkc016a.getParentId());
hgkc016a.setInvQty(hgkc016a.getInvQty().subtract(hgkc004A.getQuantity())); hgkc016a.setInvQty(hgkc016a.getInvQty().subtract(hgkc004A.getQuantity()));
hgkc016a.setInvWeight(hgkc016a.getInvQty().multiply(hgkc004A.getUnitWeight())); hgkc016a.setInvWeight(hgkc016a.getInvQty().multiply(hgkc004A.getUnitWeight()));
DaoUtils.update(HGKC016A.UPDATE_INV, hgkc016a); DaoUtils.update(HGKC016A.UPDATE_INV, hgkc016a);
}); if (hgkc016 != null){
hgkc016.setInvQty(hgkc016.getInvQty().subtract(hgkc004A.getQuantity()));
hgkc016.setInvWeight(hgkc016.getInvQty().multiply(hgkc004A.getUnitWeight()));
DaoUtils.update(HGKC016.UPDATE, hgkc016);
}
}
}else { }else {
HGKC010 hgkc010 = HGKCTools.HgKc010.get(kc004.getCompanyCode(), kc004.getWhCode(), hgkc004A.getInventCode()); HGKC010 hgkc010 = HGKCTools.HgKc010.get(kc004.getCompanyCode(), kc004.getWhCode(), hgkc004A.getInventCode());
if (hgkc010 == null) { if (hgkc010 == null) {
......
...@@ -134,7 +134,7 @@ public class ServiceHGKC017 extends ServiceEPBase { ...@@ -134,7 +134,7 @@ public class ServiceHGKC017 extends ServiceEPBase {
AssertUtils.isTrue(hgkc017.getStatus().equals(HgKcConst.HgKc017.Status.S1), "打包单已提交,不能重复提交!"); AssertUtils.isTrue(hgkc017.getStatus().equals(HgKcConst.HgKc017.Status.S1), "打包单已提交,不能重复提交!");
List<HGKC017A> hgkc017As = Optional.ofNullable(hgkc017aList).orElse(new ArrayList<>()).stream().filter(hgkc017a -> hgkc017a.getParentId().equals(hgkc017.getId())).collect(Collectors.toList()); List<HGKC017A> hgkc017As = Optional.ofNullable(hgkc017aList).orElse(new ArrayList<>()).stream().filter(hgkc017a -> hgkc017a.getParentId().equals(hgkc017.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgkc017As.size() <= 0, "打包单明细为空,不能提交!"); AssertUtils.isTrue(hgkc017As.size() <= 0, "打包单明细为空,不能提交!");
AssertUtils.isEmpty(hgkc017aList, "打包单明细为空,不能提交!");
//明细总数 //明细总数
BigDecimal totalInvQty = hgkc017As.stream().map(HGKC017A::getInvQty).reduce(BigDecimal.ZERO,BigDecimal::add); BigDecimal totalInvQty = hgkc017As.stream().map(HGKC017A::getInvQty).reduce(BigDecimal.ZERO,BigDecimal::add);
List<HGKC010> hgkc010s = Optional.ofNullable(hgkc010List).orElse(new ArrayList<>()).stream().filter(kc010 -> List<HGKC010> hgkc010s = Optional.ofNullable(hgkc010List).orElse(new ArrayList<>()).stream().filter(kc010 ->
...@@ -157,7 +157,7 @@ public class ServiceHGKC017 extends ServiceEPBase { ...@@ -157,7 +157,7 @@ public class ServiceHGKC017 extends ServiceEPBase {
hgkc017.getInventCode(),qty, invUnitWeight,invWeight); hgkc017.getInventCode(),qty, invUnitWeight,invWeight);
} }
//添加打包库存 //添加打包库存
HGKCTools.HgKc016.add(hgkc017, hgkc017As,totalInvQty); HGKCTools.HgKc016.add(hgkc017, hgkc017As, totalInvQty);
hgkc017.setStatus(HgKcConst.HgKc017.Status.S1); hgkc017.setStatus(HgKcConst.HgKc017.Status.S1);
DaoUtils.update(HGKC017.UPDATE_STATUS, hgkc017); DaoUtils.update(HGKC017.UPDATE_STATUS, hgkc017);
......
...@@ -1803,11 +1803,12 @@ public class HGKCTools { ...@@ -1803,11 +1803,12 @@ public class HGKCTools {
public static void add(HGKC017 hgkc017,List<HGKC017A> hgkc017Detail,BigDecimal totalInvQty) { public static void add(HGKC017 hgkc017,List<HGKC017A> hgkc017Detail,BigDecimal totalInvQty) {
HGKC016 hgkc016Old = HGKCTools.HgKc016.get(hgkc017.getCompanyCode(), hgkc017.getWhCode(), hgkc017.getInventCode()); HGKC016 hgkc016Old = HGKCTools.HgKc016.get(hgkc017.getCompanyCode(), hgkc017.getWhCode(), hgkc017.getInventCode());
Long id = 0L; Long id;
if (hgkc016Old != null){ if (hgkc016Old != null){
hgkc016Old.setInvQty(hgkc016Old.getInvQty().add(totalInvQty)); hgkc016Old.setInvQty(hgkc016Old.getInvQty().add(totalInvQty));
hgkc016Old.setInvWeight(hgkc016Old.getInvWeight().add(totalInvQty.multiply(hgkc017.getInvUnitWeight()))); hgkc016Old.setInvWeight(hgkc016Old.getInvWeight().add(totalInvQty.multiply(hgkc017.getInvUnitWeight())));
DaoUtils.update(HGKC016.UPDATE, hgkc016Old); DaoUtils.update(HGKC016.UPDATE, hgkc016Old);
id = hgkc016Old.getId();
}else { }else {
HGKC016 hgkc016 = new HGKC016(); HGKC016 hgkc016 = new HGKC016();
hgkc016.fromMap(hgkc017.toMap()); hgkc016.fromMap(hgkc017.toMap());
......
...@@ -116,6 +116,9 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -116,6 +116,9 @@ public class ServiceHGYX001 extends ServiceEPBase {
try { try {
List<Map> queryBlock = inInfo.getBlock(EiConstant.queryBlock).getRows(); List<Map> queryBlock = inInfo.getBlock(EiConstant.queryBlock).getRows();
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> sourceIds = resultRows.stream().map(map -> Long.valueOf(map.get("sourceId").toString())).collect(Collectors.toList());
List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds,true);
for (Map queryRow:queryBlock) { for (Map queryRow:queryBlock) {
HGYX001 hgyx001 = new HGYX001(); HGYX001 hgyx001 = new HGYX001();
hgyx001.fromMap(queryRow); hgyx001.fromMap(queryRow);
...@@ -125,6 +128,10 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -125,6 +128,10 @@ public class ServiceHGYX001 extends ServiceEPBase {
HGYX001A hgyx001A = new HGYX001A(); HGYX001A hgyx001A = new HGYX001A();
hgyx001A.fromMap(resultRow); hgyx001A.fromMap(resultRow);
hgyx001A.setParentId(hgyx001.getId()); hgyx001A.setParentId(hgyx001.getId());
if (hgyx001A.getSource() == 2){
List<HGKC016A> hgkc016as1 = Optional.ofNullable(hgkc016as).orElse(new ArrayList<>()).stream().filter(hgkc016a -> hgkc016a.getId().equals(hgyx001A.getSourceId())).collect(Collectors.toList());
AssertUtils.isEmpty(hgkc016as1, "打包单明细库存不存在,无法保存!");
}else {
HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgyx001.getCompanyCode(), hgyx001.getConsWhCode(), hgyx001A.getInventCode()); HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgyx001.getCompanyCode(), hgyx001.getConsWhCode(), hgyx001A.getInventCode());
if (hgkc010 == null) { if (hgkc010 == null) {
throw new PlatException("库存不足!"); throw new PlatException("库存不足!");
...@@ -132,6 +139,7 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -132,6 +139,7 @@ public class ServiceHGYX001 extends ServiceEPBase {
if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) { if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法保存!"); throw new PlatException("库存不足,无法保存!");
} }
}
if (hgyx001A.getId() == null || hgyx001A.getId() == 0) { if (hgyx001A.getId() == null || hgyx001A.getId() == 0) {
this.addDatail(hgyx001A); this.addDatail(hgyx001A);
} }
...@@ -142,6 +150,10 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -142,6 +150,10 @@ public class ServiceHGYX001 extends ServiceEPBase {
HGYX001A hgyx001A = new HGYX001A(); HGYX001A hgyx001A = new HGYX001A();
hgyx001A.fromMap(resultRow); hgyx001A.fromMap(resultRow);
hgyx001A.setParentId(hgyx001.getId()); hgyx001A.setParentId(hgyx001.getId());
if (hgyx001A.getSource() == 2){
List<HGKC016A> hgkc016as1 = Optional.ofNullable(hgkc016as).orElse(new ArrayList<>()).stream().filter(hgkc016a -> hgkc016a.getId().equals(hgyx001A.getSourceId())).collect(Collectors.toList());
AssertUtils.isEmpty(hgkc016as1, "打包单明细库存不存在,无法保存!");
}else {
HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgyx001.getCompanyCode(), hgyx001.getConsWhCode(), hgyx001A.getInventCode()); HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgyx001.getCompanyCode(), hgyx001.getConsWhCode(), hgyx001A.getInventCode());
if (hgkc010 == null) { if (hgkc010 == null) {
throw new PlatException("库存不足!"); throw new PlatException("库存不足!");
...@@ -149,6 +161,7 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -149,6 +161,7 @@ public class ServiceHGYX001 extends ServiceEPBase {
if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) { if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法保存!"); throw new PlatException("库存不足,无法保存!");
} }
}
if (hgyx001A.getId() == null || hgyx001A.getId() == 0) { if (hgyx001A.getId() == null || hgyx001A.getId() == 0) {
this.addDatail(hgyx001A); this.addDatail(hgyx001A);
}else { }else {
...@@ -316,8 +329,8 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -316,8 +329,8 @@ public class ServiceHGYX001 extends ServiceEPBase {
List<Map> queryBlock = inInfo.getBlock(EiConstant.queryBlock).getRows(); List<Map> queryBlock = inInfo.getBlock(EiConstant.queryBlock).getRows();
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
//查询打包单明细 //查询打包单明细
List<Long> sourceIds = resultRows.stream().map(map -> (Long) map.get("sourceIds")).collect(Collectors.toList()); List<Long> sourceIds = resultRows.stream().map(map -> Long.parseLong(map.get("sourceId").toString())).collect(Collectors.toList());
List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds,true); List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds);
for (Map queryRow:queryBlock) { for (Map queryRow:queryBlock) {
HGYX001 hgyx001 = new HGYX001(); HGYX001 hgyx001 = new HGYX001();
hgyx001.fromMap(queryRow); hgyx001.fromMap(queryRow);
......
...@@ -148,8 +148,8 @@ $(function () { ...@@ -148,8 +148,8 @@ $(function () {
for (let i = 0; i < inventRecordBox.length; i++) { for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === item['inventCode']) { if (inventRecordBox[i]['valueField'] === item['inventCode']) {
resultGrid.setCellValue(item, 'inventName', inventRecordBox[i]['textField']); resultGrid.setCellValue(item, 'inventName', inventRecordBox[i]['textField']);
resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBox[i]['param1Field']) resultGrid.setCellValue(e.items[0], 'inventType', inventRecordBox[i]['param1Field'])
resultGrid.setCellValue(e.items[0], 'inventType', inventRecordBox[i]['param10Field']) resultGrid.setCellValue(e.items[0], 'inventTypeDetail', inventRecordBox[i]['param10Field'])
resultGrid.setCellValue(e.items[0], 'specId', inventRecordBox[i]['param2Field']) resultGrid.setCellValue(e.items[0], 'specId', inventRecordBox[i]['param2Field'])
resultGrid.setCellValue(e.items[0], 'spec', inventRecordBox[i]['param3Field']) resultGrid.setCellValue(e.items[0], 'spec', inventRecordBox[i]['param3Field'])
resultGrid.setCellValue(e.items[0], 'length', inventRecordBox[i]['param4Field']) resultGrid.setCellValue(e.items[0], 'length', inventRecordBox[i]['param4Field'])
......
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