Commit 51730006 by liuyang

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

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