Commit 2678361a by liuyang

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

parent 36134080
......@@ -7,7 +7,8 @@ package com.baosight.hggp.common;
public enum InventorySource {
MANUAL_ENTRY(1,"手动录入"),
INVENTORY(2,"盘点"),
ALLOCATION(3,"调拨");
ALLOCATION(3,"调拨"),
PACKING_ORDER(4,"打包单");
private Integer code;
......
......@@ -54,6 +54,8 @@ public class HGKC004A extends DaoEPBase {
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_SOURCE = "source"; /* 数据来源*/
public static final String FIELD_SOURCE_ID = "sourceId"; /* 数据来源*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -128,6 +130,9 @@ public class HGKC004A extends DaoEPBase {
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String inventTypeDetail;
private Integer source; /* 数据来源*/
private Long sourceId = new Long(0); /* 数据来源*/
......@@ -286,6 +291,14 @@ public class HGKC004A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE_ID);
eiColumn.setDescName("数据来源ID");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -751,6 +764,23 @@ public class HGKC004A extends DaoEPBase {
this.inventTypeDetail = inventTypeDetail;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
/**
* get the value from Map.
*
......@@ -791,6 +821,9 @@ public class HGKC004A extends DaoEPBase {
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setInventTypeDetail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setSourceId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_SOURCE_ID)), sourceId));
}
/**
......@@ -832,6 +865,8 @@ public class HGKC004A extends DaoEPBase {
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_INVENT_TYPE_DETAIL,StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_SOURCE_ID, StringUtils.toString(sourceId, eiMetadata.getMeta(FIELD_SOURCE_ID)));
return map;
}
......
......@@ -82,6 +82,7 @@ public class HGKC016A extends DaoEPBase {
public static final String COUNT = "HGKC016A.count";
public static final String INSERT = "HGKC016A.insert";
public static final String UPDATE = "HGKC016A.update";
public static final String UPDATE_INV = "HGKC016A.updateInv";
public static final String DELETE = "HGKC016A.delete";
private Long id = new Long(0);
......
......@@ -140,7 +140,7 @@ public class HGKC017 extends DaoEPBase {
private BigDecimal thick = new BigDecimal(0.000); /* 厚度*/
private BigDecimal invQty = new BigDecimal(0); /* 库存数量*/
private String packWay = " "; /* 打包方式*/
private String packNum = " "; /* 打包数量*/
private BigDecimal packNum = new BigDecimal(0); /* 打包数量*/
private BigDecimal invUnitWeight = new BigDecimal(0.000); /* 库存单重*/
private BigDecimal invWeight = new BigDecimal(0.000); /* 库存重量*/
private String factoryCode = " "; /* 厂区编码*/
......@@ -294,6 +294,9 @@ public class HGKC017 extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PACK_NUM);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("打包数量");
eiMetadata.addMeta(eiColumn);
......@@ -813,7 +816,7 @@ public class HGKC017 extends DaoEPBase {
* get the packNum - 打包数量.
* @return the packNum
*/
public String getPackNum() {
public BigDecimal getPackNum() {
return this.packNum;
}
......@@ -822,7 +825,7 @@ public class HGKC017 extends DaoEPBase {
*
* @param packNum - 打包数量
*/
public void setPackNum(String packNum) {
public void setPackNum(BigDecimal packNum) {
this.packNum = packNum;
}
/**
......@@ -991,7 +994,7 @@ public class HGKC017 extends DaoEPBase {
setThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_THICK)), thick));
setInvQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_QTY)), invQty));
setPackWay(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PACK_WAY)), packWay));
setPackNum(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PACK_NUM)), packNum));
setPackNum(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PACK_NUM)), packNum));
setInvUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_UNIT_WEIGHT)), invUnitWeight));
setInvWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_WEIGHT)), invWeight));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
......
......@@ -112,7 +112,7 @@ public class HGKC017A extends DaoEPBase {
private BigDecimal invUnitWeight = new BigDecimal(0.000); /* 库存单重*/
private BigDecimal invWeight = new BigDecimal(0.000); /* 库存重量*/
private Integer inventTypeDetail = 0; /* 存货类型大类*/
private BigDecimal packQuantity = new BigDecimal(0);
private BigDecimal packQuantity = new BigDecimal(0); /* 打包数量*/
/**
* initialize the metadata.
......
......@@ -11,6 +11,7 @@ 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.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
......@@ -18,6 +19,7 @@ import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.yx.domain.HGYX001A;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -31,6 +33,7 @@ import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
......@@ -171,10 +174,24 @@ public class ServiceHGKC004 extends ServiceEPBase {
HGCWTools.HgCw001.getAccountPeriod(kc004.getCompanyCode(),kc004.getReceiptDate());
List<HGKC004A> hgkc004s = HGKCTools.HgKc004.getDetailById(hgkc004.getId());
AssertUtils.isEmpty(hgkc004s, "销售出库单明细不存在!");
//查询打包单明细
List<Long> sourceIds = Optional.ofNullable(hgkc004s).orElse(new ArrayList<>()).stream().map(HGKC004A::getSourceId).collect(Collectors.toList());
List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds);
for (HGKC004A hgkc004A : hgkc004s) {
if (hgkc004A.getPrice().compareTo(BigDecimal.ZERO) < 0 || hgkc004A.getAmount().compareTo(BigDecimal.ZERO) < 0){
throw new PlatException("单价和金额不能小于0!");
}
// 2 打包单 1 实时库存
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 -> {
hgkc016a.setInvQty(hgkc016a.getInvQty().subtract(hgkc004A.getQuantity()));
hgkc016a.setInvWeight(hgkc016a.getInvQty().multiply(hgkc004A.getUnitWeight()));
DaoUtils.update(HGKC016A.UPDATE_INV, hgkc016a);
});
}else {
HGKC010 hgkc010 = HGKCTools.HgKc010.get(kc004.getCompanyCode(), kc004.getWhCode(), hgkc004A.getInventCode());
if (hgkc010 == null) {
throw new PlatException("库存不足!");
......@@ -190,6 +207,8 @@ public class ServiceHGKC004 extends ServiceEPBase {
}
DaoUtils.update(HGKC010.UPDATE_INV, hgkc010);
}
}
DaoUtils.update(HGKC004.UPDATE_STATUS, hgkc004);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC016;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/10/24
* @description
*/
public class ServiceHGKC016 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
//Map<String, Object> paramMap = new HashMap<>();
//paramMap.put("inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.WH_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BLOCK_ID),null, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC016().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC016.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo,HGKC016.QUERY,new HGKC016());
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC016A;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/10/24
* @description
*/
public class ServiceHGKC016A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.WH_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),null, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC016A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC016A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "isInvQty", true);
return super.query(inInfo,HGKC016A.QUERY,new HGKC016A());
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC016A;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/26
* @description
*/
public class ServiceHGKC016B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),null, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC016A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC016A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo,HGKC016A.QUERY,new HGKC016A());
List<Map> list = inInfo.addBlock(EiConstant.resultBlock).getRows();
List<HGKC016A> hgkc016As = new ArrayList<>();
for (Map map: list) {
HGKC016A hgkc016A = new HGKC016A();
hgkc016A.fromMap(map);
hgkc016A.setId(null);
hgkc016As.add(hgkc016A);
}
inInfo.getBlock(EiConstant.resultBlock).setRows(hgkc016As);
return inInfo;
}
public EiInfo save(EiInfo inInfo) {
try {
Map paramMap = EiInfoUtils.getFirstRow(inInfo);
List<Map> list = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map map: list) {
HGKC016A hgkc016A = new HGKC016A();
hgkc016A.fromMap(map);
DaoUtils.insert(HGKC016A.INSERT, hgkc016A);
}
DaoUtils.update(HGKC016A.DELETE, paramMap);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(list.size()), I18nMessages.getText("label.update", "保存")});
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
......@@ -3,13 +3,16 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.common.InventorySource;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.constant.HgKcConst;
import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
......@@ -21,6 +24,7 @@ import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -36,10 +40,10 @@ public class ServiceHGKC017 extends ServiceEPBase {
try {
//Map<String, Object> paramMap = new HashMap<>();
//paramMap.put("inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.WH_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),null, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC010().eiMetadata);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC017().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......@@ -63,7 +67,7 @@ public class ServiceHGKC017 extends ServiceEPBase {
try {
List<HGKC017> hgkc017List = MapUtils.toDaoEPBases(inInfo, EiConstant.resultBlock, HGKC017.class);
for (HGKC017 hgkc017 : hgkc017List) {
if (hgkc017.getStatus()==1) {
if (hgkc017.getStatus().equals(HgKcConst.HgKc017.Status.S1)) {
throw new PlatException("打包单已提交,不能删除!");
}
DaoUtils.update(HGKC017.DELETE_FLAG, hgkc017);
......@@ -123,14 +127,44 @@ public class ServiceHGKC017 extends ServiceEPBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = resultRows.stream().map(map -> Long.valueOf(map.get("id").toString())).collect(Collectors.toList());
List<HGKC017A> hgkc017aList = HGKCTools.HgKc017a.getByParentId(ids);
List<HGKC010> hgkc010List = DaoBase.getInstance().query(HGKC010.QUERY, null);
for (Map resultRow : resultRows) {
HGKC017 hgkc017 = new HGKC017();
hgkc017.fromMap(resultRow);
AssertUtils.isTrue(hgkc017.getStatus().equals(HgKcConst.HgKc017.Status.S1), "打包单已提交,不能重复提交!");
List<HGKC017A> hgkc017AS = Optional.ofNullable(hgkc017aList).orElse(new ArrayList<>()).stream().filter(hgkc017a -> hgkc017a.getId().equals(hgkc017.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgkc017AS.size() <= 0, "打包单明细为空,不能提交!");
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, "打包单明细为空,不能提交!");
DaoUtils.update(HGKC017.UPDATE_STATUS, 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 ->
kc010.getCompanyCode().equals(hgkc017.getCompanyCode()) &&
kc010.getWhCode().equals(hgkc017.getWhCode()) &&
kc010.getInventCode().equals(hgkc017.getInventCode())
).collect(Collectors.toList());
if (hgkc010s.size() <= 0) {
throw new PlatException("实时库存不存在!");
}
if (totalInvQty.compareTo(hgkc010s.get(0).getInvQty()) > 0){
throw new PlatException("库存不足,请重新选择!");
}else {
//需要为负数
BigDecimal qty = totalInvQty.multiply(new BigDecimal(-1));
BigDecimal invUnitWeight = hgkc017As.get(0).getInvUnitWeight().multiply(new BigDecimal(-1));
BigDecimal invWeight = totalInvQty.multiply(invUnitWeight).multiply(new BigDecimal(-1));
//减少库存
HGKCUtils.HgKc010.updateInv(hgkc017.getCompanyCode(),hgkc017.getWhCode(),
hgkc017.getInventCode(),qty, invUnitWeight,invWeight);
}
//添加打包库存
HGKCTools.HgKc016.add(hgkc017, hgkc017As,totalInvQty);
hgkc017.setStatus(HgKcConst.HgKc017.Status.S1);
DaoUtils.update(HGKC017.UPDATE_STATUS, hgkc017);
//添加其他入库单
addHgKc006(hgkc017, hgkc017As);
//添加其他出库
addHgKc007(hgkc017, hgkc017As);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......@@ -140,4 +174,95 @@ public class ServiceHGKC017 extends ServiceEPBase {
}
return inInfo;
}
//其他入库单
public void addHgKc006(HGKC017 hgkc017, List<HGKC017A> hgkc017As) {
HGKC006 hgkc006 = new HGKC006();
hgkc006.setCompanyCode(hgkc017.getCompanyCode());
hgkc006.setCompanyName(hgkc017.getCompanyName());
hgkc006.setWhCode(hgkc017.getWhCode());
hgkc006.setWhName(hgkc017.getWhName());
hgkc006.setProjCode(hgkc017.getProjCode());
hgkc006.setProjName(hgkc017.getProjName());
hgkc006.setOtherEnterDate(DateUtils.formatShort(DateUtils.shortDate()));
hgkc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.OTHER_ENTER_NO));
hgkc006.setSource(InventorySource.PACKING_ORDER.getCode());
hgkc006.setSubmitStatus(HGConstant.ProductStatus.YTJ);
DaoUtils.insert(HGKC006.INSERT, hgkc006);
this.addHgKc006a(hgkc017As, hgkc006);
}
//其他入库明细
public void addHgKc006a(List<HGKC017A> hgkc017As, HGKC006 hgkc006) {
for (HGKC017A hgkc017A: hgkc017As) {
HGKC006A hgkc006a = new HGKC006A();
hgkc006a.setPrimaryId(hgkc006.getId());
hgkc006a.setCompanyCode(hgkc006.getCompanyCode());
hgkc006a.setCompanyName(hgkc006.getCompanyName());
hgkc006a.setWhCode(hgkc006.getWhCode());
hgkc006a.setWhName(hgkc006.getWhName());
hgkc006a.setProjCode(hgkc006.getProjCode());
hgkc006a.setProjName(hgkc006.getProjName());
hgkc006a.setOtherEnterDate(hgkc006.getOtherEnterDate());
hgkc006a.setOtherEnterNo(hgkc006.getOtherEnterNo());
hgkc006a.setInventType(hgkc017A.getInventType());
hgkc006a.setInventCode(hgkc017A.getInventCode());
hgkc006a.setInventName(hgkc017A.getInventName());
hgkc006a.setInvQty(hgkc017A.getInvQty());
hgkc006a.setInvWeight(hgkc017A.getInvWeight());
hgkc006a.setInvUnitWeight(hgkc017A.getInvUnitWeight());
hgkc006a.setPrdtSpec(hgkc017A.getSpec());
hgkc006a.setPrdtLength(hgkc017A.getLength());
hgkc006a.setPrdtWidth(hgkc017A.getWidth());
hgkc006a.setPrdtThick(hgkc017A.getThick());
hgkc006a.setSource(hgkc006.getSource());
hgkc006a.setInventTypeDetail(hgkc017A.getInventTypeDetail());
DaoUtils.insert(HGKC006A.INSERT, hgkc006a);
}
}
//其他出库
public void addHgKc007(HGKC017 hgkc017, List<HGKC017A> hgkc017As) {
HGKC007 hgkc007 = new HGKC007();
hgkc007.setCompanyCode(hgkc017.getCompanyCode());
hgkc007.setCompanyName(hgkc017.getCompanyName());
hgkc007.setWhCode(hgkc017.getWhCode());
hgkc007.setWhName(hgkc017.getWhName());
hgkc007.setProjCode(hgkc017.getProjCode());
hgkc007.setProjName(hgkc017.getProjName());
hgkc007.setOtherOutDate(DateUtils.formatShort(DateUtils.shortDate()));
hgkc007.setOtherOutNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.OTHER_OUT_NO));
hgkc007.setSubmitStatus(HGConstant.ProductStatus.YTJ);
hgkc007.setSource(InventorySource.PACKING_ORDER.getCode());
DaoUtils.insert(HGKC007.INSERT, hgkc007);
addHgKc007a(hgkc017As, hgkc007);
}
//其他出库明细
public void addHgKc007a(List<HGKC017A> hgkc017As, HGKC007 hgkc007) {
for (HGKC017A hgkc017A: hgkc017As) {
HGKC007A hgkc007a = new HGKC007A();
hgkc007a.setPrimaryId(hgkc007.getId());
hgkc007a.setCompanyCode(hgkc007.getCompanyCode());
hgkc007a.setCompanyName(hgkc007.getCompanyName());
hgkc007a.setWhCode(hgkc007.getWhCode());
hgkc007a.setWhName(hgkc007.getWhName());
hgkc007a.setProjCode(hgkc007.getProjCode());
hgkc007a.setProjName(hgkc007.getProjName());
hgkc007a.setOtherOutDate(hgkc007.getOtherOutDate());
hgkc007a.setOtherOutNo(hgkc007.getOtherOutNo());
hgkc007a.setInventType(hgkc017A.getInventType());
hgkc007a.setInventCode(hgkc017A.getInventCode());
hgkc007a.setInventName(hgkc017A.getInventName());
hgkc007a.setInvQty(hgkc017A.getInvQty());
hgkc007a.setInvWeight(hgkc017A.getInvWeight());
hgkc007a.setInvUnitWeight(hgkc017A.getInvUnitWeight());
hgkc007a.setPrdtSpec(hgkc017A.getSpec());
hgkc007a.setPrdtLength(hgkc017A.getLength());
hgkc007a.setPrdtWidth(hgkc017A.getWidth());
hgkc007a.setPrdtThick(hgkc017A.getThick());
hgkc007a.setSource(hgkc007.getSource());
hgkc007a.setInventTypeDetail(hgkc017A.getInventTypeDetail());
DaoUtils.insert(HGKC007A.INSERT, hgkc007a);
}
}
}
......@@ -4,10 +4,14 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.constant.HgKcConst;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC017;
import com.baosight.hggp.hg.kc.domain.HGKC017A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
......@@ -17,11 +21,12 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.*;
/**
* @author LiuYang
......@@ -34,7 +39,7 @@ public class ServiceHGKC017A extends ServiceEPBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
//paramMap.put("inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),paramMap);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
......@@ -47,18 +52,62 @@ public class ServiceHGKC017A extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC017A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGKC017A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo,HGKC017A.QUERY,new HGKC017A());
List<HGKC017A> hgkc017AList = new ArrayList<>();
if (inInfo.getBlock(EiConstant.resultBlock).getRows().size() == 0) {
HGKC017 hgkc017 = HGKCTools.HgKc017.getById(Long.parseLong(queryMap.get(HGKC017A.FIELD_PARENT_ID).toString()));
HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgkc017.getCompanyCode(), hgkc017.getWhCode(), hgkc017.getInventCode());
return super.query(inInfo,HGKC017A.QUERY,new HGKC017());
if (CollectionUtils.isNotEmpty(Collections.singleton(hgkc010))){
BigDecimal invQty = hgkc010.getInvQty();
BigDecimal packNum = hgkc017.getInvQty();
MathContext mc = new MathContext(0, RoundingMode.HALF_UP);
BigDecimal[] result = invQty.divideAndRemainder(packNum, mc);
for (int i = 0; i < result[0].intValue(); i++) {
HGKC017A hgkc017a = new HGKC017A();
hgkc017a.fromMap(hgkc010.toMap());
hgkc017a.setInvQty(packNum);
hgkc017a.setInvUnitWeight(hgkc010.getInvUnitWeight());
hgkc017a.setInvWeight(hgkc017.getInvQty().multiply(hgkc010.getInvUnitWeight()));
hgkc017a.setUnit(hgkc017.getUnit());
hgkc017a.setPackWay(hgkc017.getPackWay());
hgkc017a.setPackQuantity(BigDecimal.ONE);
hgkc017a.setId(null);
hgkc017AList.add(hgkc017a);
}
if (result[1].compareTo(BigDecimal.ZERO) > 0){
HGKC017A hgkc017a = new HGKC017A();
hgkc017a.fromMap(hgkc010.toMap());
hgkc017a.setInvQty(result[1]);
hgkc017a.setInvUnitWeight(hgkc010.getInvUnitWeight());
hgkc017a.setInvWeight(hgkc017.getInvQty().multiply(hgkc010.getInvUnitWeight()));
hgkc017a.setUnit(hgkc017.getUnit());
hgkc017a.setPackWay(hgkc017.getPackWay());
hgkc017a.setPackQuantity(BigDecimal.ONE);
hgkc017a.setId(null);
hgkc017AList.add(hgkc017a);
}
}
inInfo.getBlock(EiConstant.resultBlock).setRows(hgkc017AList);
}
return inInfo;
}
@OperationLogAnnotation(operModul = "打包单",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGKC017 hgkc017 = HGKCTools.HgKc017.getById(Long.parseLong(queryMap.get(HGKC017A.FIELD_PARENT_ID).toString()));
if (hgkc017 != null){
AssertUtils.isTrue(hgkc017.getStatus().equals(HgKcConst.HgKc017.Status.S1), "打包单已提交,不能删除!");
}
List<HGKC017A> hgkc017aList = MapUtils.toDaoEPBases(inInfo, EiConstant.resultBlock, HGKC017A.class);
for (HGKC017A hgkc017a : hgkc017aList) {
DaoUtils.update(HGKC017.DELETE, hgkc017a);
DaoUtils.update(HGKC017A.DELETE, hgkc017a);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(hgkc017aList.size()), I18nMessages.getText("label.delete", "删除")});
......@@ -71,19 +120,20 @@ public class ServiceHGKC017A extends ServiceEPBase {
@OperationLogAnnotation(operModul = "打包单",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HGKC017A> hgkc017AList = MapUtils.toDaoEPBases(inInfo,HGKC017A.class);
// 写入数据
for (Map resultRow : resultRows) {
HGKC017A hgkc017a = new HGKC017A();
hgkc017a.fromMap(resultRow);
if (hgkc017a.getId() == null || hgkc017a.getId() == 0) {
this.add(hgkc017a);
for (HGKC017A hgkc017A : hgkc017AList) {
if (hgkc017A.getId() == null || hgkc017A.getId() == 0) {
hgkc017A.setParentId(Long.parseLong(queryMap.get(HGKC017A.FIELD_PARENT_ID).toString()));
hgkc017A.setPackCode(queryMap.get(HGKC017A.FIELD_PACK_CODE).toString());
this.add(hgkc017A);
} else {
this.modify(hgkc017a);
this.modify(hgkc017A);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
inInfo.setMsg("操作成功!本次对[" + hgkc017AList.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
......@@ -94,7 +144,6 @@ public class ServiceHGKC017A extends ServiceEPBase {
* 新增操作
*/
public void add(HGKC017A hgkc017a) {
//hgkc017a.setPackCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PACK_CODE));
DaoUtils.insert(HGKC017A.INSERT, hgkc017a);
}
......@@ -104,4 +153,11 @@ public class ServiceHGKC017A extends ServiceEPBase {
public void modify(HGKC017A hgkc017a) {
DaoUtils.update(HGKC017A.UPDATE, hgkc017a);
}
public EiInfo getOnt(EiInfo inInfo) {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HGKC010> list = DaoBase.getInstance().query(HGKC010.QUERY, queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(list);
return inInfo;
}
}
......@@ -31,7 +31,9 @@
PARENT_ID as "parentId", <!-- 销售出库单ID -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount", <!-- 金额 -->
INVENT_TYPE_DETAIL as "inventTypeDetail"
INVENT_TYPE_DETAIL as "inventTypeDetail",
SOURCE as "source",
SOURCE_ID as "sourceId"
</sql>
<sql id="condition">
......@@ -117,6 +119,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
SOURCE = #source#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sourceId">
SOURCE_ID = #sourceId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="HashMap" resultClass="HGKC004A">
......@@ -167,9 +175,14 @@
PARENT_ID, <!-- 销售出库单ID -->
PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL
INVENT_TYPE_DETAIL,
SOURCE,
SOURCE_ID
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #spec#, #length#, #width#, #thick#, #quantity#, #unitWeight#, #weight#, #parentId#, #price#, #amount#,#inventTypeDetail#)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventRecordId#, #inventType#, #inventCode#,
#inventName#, #spec#, #length#, #width#, #thick#, #quantity#, #unitWeight#, #weight#, #parentId#, #price#,
#amount#,#inventTypeDetail#, #source#, #sourceId#)
</insert>
<delete id="delete">
......@@ -216,7 +229,9 @@
PARENT_ID = #parentId#, <!-- 销售出库单ID -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额 -->
INVENT_TYPE_DETAIL = #inventTypeDetail#
INVENT_TYPE_DETAIL = #inventTypeDetail#,
SOURCE = #source#,
SOURCE_ID = #sourceId#
WHERE
ID = #id#
</update>
......@@ -231,6 +246,8 @@
b.WH_CODE AS "whCode",
b.PROJ_CODE AS "projCode",
a.INVENT_CODE AS "inventCode",
a.SOURCE as "source",
a.SOURCE_ID as "sourceId",
COALESCE(SUM(QUANTITY), 0) AS "quantity",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hggpSchema}.HGKC004A a LEFT JOIN ${hggpSchema}.HGKC004 b on a.PARENT_ID = b.ID
......@@ -238,7 +255,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom">
a.CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY a.ACCOUNT_CODE,a.COMPANY_CODE,a.COMPANY_NAME, a.DEP_CODE, b.WH_CODE, b.PROJ_CODE, a.INVENT_CODE
GROUP BY a.ACCOUNT_CODE,a.COMPANY_CODE,a.COMPANY_NAME, a.DEP_CODE, b.WH_CODE, b.PROJ_CODE, a.INVENT_CODE, a.SOURCE, a.SOURCE_ID
</select>
<select id="queryDetail" resultClass="com.baosight.hggp.hg.kc.domain.HGKC004A">
......@@ -252,6 +269,8 @@
a.INVENT_CODE AS "inventCode",
a.SPEC as "spec",
a.INVENT_TYPE_DETAIL as "inventTypeDetail",
a.SOURCE as "source",
a.SOURCE_ID as "sourceId",
COALESCE(SUM(a.QUANTITY), 0) AS "quantity",
COALESCE(SUM(a.WEIGHT), 0) AS "weight",
COALESCE(SUM(a.AMOUNT)) as "amount"
......@@ -278,7 +297,7 @@
<isEmpty prepend=" AND " property="submitStatus">
b.STATUS = 1
</isEmpty>
GROUP BY a.ACCOUNT_CODE, a.DEP_CODE, a.COMPANY_CODE, b.WH_CODE, a.INVENT_RECORD_ID, a.INVENT_TYPE, a.INVENT_CODE, a.SPEC,a.INVENT_TYPE_DETAIL
GROUP BY a.ACCOUNT_CODE, a.DEP_CODE, a.COMPANY_CODE, b.WH_CODE, a.INVENT_RECORD_ID, a.INVENT_TYPE, a.INVENT_CODE, a.SPEC,a.INVENT_TYPE_DETAIL, a.SOURCE, a.SOURCE_ID
</select>
</sqlMap>
......@@ -163,12 +163,28 @@
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="notSpecIds">
SPEC_ID NOT IN <iterate close=")" open="(" conjunction="," property="notSpecIds">#notSpecIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC016">
SELECT
<include refid="column" />
FROM ${hggpSchema}.HGKC016 WHERE 1=1
<include refid="condition" />
<include refid="idCondition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -315,7 +331,7 @@
#inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #invQty#, #invUnitWeight#,
#invWeight#, #factoryCode#, #factoryName#, #inventTypeDetail#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
select last_insert_id()
select MAX(ID) AS "id" FROM ${hggpSchema}.HGKC016
</selectKey>
</insert>
......
......@@ -116,6 +116,15 @@
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isInvQty">
INV_QTY > 0
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -287,6 +296,19 @@
ID = #id#
</delete>
<!-- 更新库存 -->
<update id="updateInv">
UPDATE ${hggpSchema}.HGKC016A
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
INV_QTY = #invQty#, <!-- 库存数量 -->
INV_UNIT_WEIGHT = #invUnitWeight#, <!-- 库存单重 -->
INV_WEIGHT = #invWeight# <!-- 库存重量 -->
WHERE ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGKC016A
SET
......
......@@ -415,7 +415,7 @@
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
STATUS = #status#, <!-- 提交状态 -->
STATUS = #status# <!-- 提交状态 -->
WHERE
ID = #id#
</update>
......
......@@ -120,9 +120,9 @@
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
<!--<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
</isNotEmpty>-->
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
......@@ -268,9 +268,6 @@
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
PARENT_ID, <!-- 打包ID -->
PACK_CODE, <!-- 打包单号 -->
......@@ -291,10 +288,10 @@
INVENT_TYPE_DETAIL, <!-- 存货类型大类 -->
PACK_QUANTITY
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #parentId#, #packCode#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#,
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#parentId#, #packCode#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#,
#material#, #unit#, #length#, #width#, #thick#, #packWay#, #invQty#, #invUnitWeight#, #invWeight#,
#inventTypeDetail#)
#inventTypeDetail#,#packQuantity#)
</insert>
<delete id="delete">
......@@ -305,11 +302,6 @@
<update id="update">
UPDATE ${hggpSchema}.HGKC017A
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
......
......@@ -1769,6 +1769,18 @@ public class HGKCTools {
public static class HgKc016 {
public static HGKC016 get(String companyCode, String whCode, String inventCode) {
AssertUtils.isEmpty(companyCode, "公司编码不能为空");
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
AssertUtils.isEmpty(inventCode, "物料编码不能为空");
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode);
paramMap.put("inventCode", inventCode);
List<HGKC016> results = DaoBase.getInstance().query(HGKC016.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static HGKC016 getById(Long id) {
AssertUtils.isEmpty(Collections.singleton(id), "打包库存ID不能为空");
......@@ -1788,10 +1800,55 @@ public class HGKCTools {
List<HGKC016> list = DaoBase.getInstance().query(HGKC016.QUERY, paramMap);
return CollectionUtils.isEmpty(list) ? null : list;
}
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;
if (hgkc016Old != null){
hgkc016Old.setInvQty(hgkc016Old.getInvQty().add(totalInvQty));
hgkc016Old.setInvWeight(hgkc016Old.getInvWeight().add(totalInvQty.multiply(hgkc017.getInvUnitWeight())));
DaoUtils.update(HGKC016.UPDATE, hgkc016Old);
}else {
HGKC016 hgkc016 = new HGKC016();
hgkc016.fromMap(hgkc017.toMap());
hgkc016.setInvQty(totalInvQty);
hgkc016.setInvWeight(totalInvQty.multiply(hgkc017.getInvUnitWeight()));
hgkc016.setId(null);
DaoUtils.insert(HGKC016.INSERT, hgkc016);
id = hgkc016.getId();
}
for (HGKC017A hgkc017A: hgkc017Detail) {
HgKc016a.add(hgkc017A, id);
}
}
}
public static class HgKc016a {
public static List<HGKC016A> getById(List<Long> ids) {
if (Objects.isNull(ids)) {
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ids", ids);
paramMap.put("deleteFlag", 0);
List<HGKC016A> list = DaoBase.getInstance().query(HGKC016A.QUERY, paramMap);
return CollectionUtils.isEmpty(list) ? null : list;
}
public static List<HGKC016A> getById(List<Long> ids,Boolean isInvQty) {
if (Objects.isNull(ids)) {
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("ids", ids);
paramMap.put("isInvQty", isInvQty);
paramMap.put("deleteFlag", 0);
List<HGKC016A> list = DaoBase.getInstance().query(HGKC016A.QUERY, paramMap);
return CollectionUtils.isEmpty(list) ? null : list;
}
public static List<HGKC016A> getByParentId(Long parentId) {
if (Objects.isNull(parentId)) {
return new ArrayList<>();
......@@ -1812,6 +1869,14 @@ public class HGKCTools {
List<HGKC016A> list = DaoBase.getInstance().query(HGKC016A.QUERY, paramMap);
return CollectionUtils.isEmpty(list) ? null : list;
}
public static void add(HGKC017A hgkc017A, Long parentId) {
HGKC016A hgkc016a = new HGKC016A();
hgkc016a.fromMap(hgkc017A.toMap());
hgkc016a.setParentId(parentId);
hgkc016a.setId(null);
DaoUtils.insert(HGKC016A.INSERT, hgkc016a);
}
}
public static class HgKc017 {
......
......@@ -46,6 +46,8 @@ public class HGYX001A extends DaoEPBase {
public static final String FIELD_WEIGHT = "weight"; /* 发货重量*/
public static final String FIELD_PARENT_ID = "parentId"; /* 销售发货ID*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_SOURCE = "source"; /* 数据来源*/
public static final String FIELD_SOURCE_ID = "sourceId"; /* 数据来源*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -103,6 +105,8 @@ public class HGYX001A extends DaoEPBase {
private BigDecimal weight = new BigDecimal("0"); /* 发货重量*/
private Long parentId = new Long(0); /* 销售发货ID*/
private String inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
private Integer source; /* 数据来源*/
private Long sourceId = new Long(0); /* 数据来源*/
/**
* initialize the metadata.
......@@ -225,6 +229,13 @@ public class HGYX001A extends DaoEPBase {
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE_ID);
eiColumn.setDescName("数据来源ID");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -597,6 +608,22 @@ public class HGYX001A extends DaoEPBase {
this.inventTypeDetail = inventTypeDetail;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
/**
* get the value from Map.
*
......@@ -629,6 +656,8 @@ public class HGYX001A extends DaoEPBase {
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setParentId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setInventTypeDetail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setSourceId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_SOURCE_ID)), sourceId));
}
/**
......@@ -662,6 +691,8 @@ public class HGYX001A extends DaoEPBase {
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_INVENT_TYPE_DETAIL,StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_SOURCE_ID, StringUtils.toString(sourceId, eiMetadata.getMeta(FIELD_SOURCE_ID)));
return map;
}
......
......@@ -53,6 +53,7 @@ public class HGYX001C extends DaoEPBase {
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区编码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_SOURCE = "source"; /* 数据来源*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -120,6 +121,7 @@ public class HGYX001C extends DaoEPBase {
private String factoryCode = " "; /* 厂区编码*/
private String factoryName = " "; /* 厂区名称*/
private String inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
private Integer source; /* 数据来源*/
/**
* initialize the metadata.
......@@ -265,6 +267,10 @@ public class HGYX001C extends DaoEPBase {
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -731,6 +737,14 @@ public class HGYX001C extends DaoEPBase {
this.inventTypeDetail = inventTypeDetail;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
/**
* get the value from Map.
*
......@@ -769,6 +783,7 @@ public class HGYX001C extends DaoEPBase {
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_CODE)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FACTORY_NAME)), factoryName));
setInventTypeDetail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
}
/**
......@@ -808,6 +823,7 @@ public class HGYX001C extends DaoEPBase {
map.put(FIELD_FACTORY_CODE, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_FACTORY_CODE)));
map.put(FIELD_FACTORY_NAME, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_FACTORY_NAME)));
map.put(FIELD_INVENT_TYPE_DETAIL,StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
return map;
}
......
......@@ -48,6 +48,8 @@ public class HGYX002A extends DaoEPBase {
public static final String FIELD_RETURN_WEIGHT = "returnWeight"; /* 退货重量*/
public static final String FIELD_PARENT_ID = "parentId"; /* 销售退货ID*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_SOURCE = "source"; /* 数据来源*/
public static final String FIELD_SOURCE_ID = "sourceId"; /* 数据来源*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -109,6 +111,8 @@ public class HGYX002A extends DaoEPBase {
private BigDecimal returnWeight = new BigDecimal(0.000); /* 退货重量*/
private Long parentId = new Long(0); /* 销售退货ID*/
private String inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
private Integer source; /* 数据来源*/
private Long sourceId = new Long(0); /* 数据来源*/
/**
* initialize the metadata.
......@@ -244,6 +248,14 @@ public class HGYX002A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE_ID);
eiColumn.setDescName("数据来源ID");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -655,6 +667,22 @@ public class HGYX002A extends DaoEPBase {
this.inventTypeDetail = inventTypeDetail;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
/**
* get the value from Map.
*
......@@ -689,6 +717,8 @@ public class HGYX002A extends DaoEPBase {
setReturnWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_RETURN_WEIGHT)), returnWeight));
setParentId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setInventTypeDetail(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setSourceId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_SOURCE_ID)), sourceId));
}
/**
......@@ -724,6 +754,8 @@ public class HGYX002A extends DaoEPBase {
map.put(FIELD_RETURN_WEIGHT, StringUtils.toString(returnWeight, eiMetadata.getMeta(FIELD_RETURN_WEIGHT)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_INVENT_TYPE_DETAIL,StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_SOURCE_ID, StringUtils.toString(sourceId, eiMetadata.getMeta(FIELD_SOURCE_ID)));
return map;
}
......
......@@ -11,6 +11,7 @@ import com.baosight.hggp.hg.cw.vo.UserVO;
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.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
......@@ -35,10 +36,8 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
......@@ -269,7 +268,15 @@ public class ServiceHGYX001 extends ServiceEPBase {
* 新增销售退货详情
*/
public void addHGKC004A(List<HGYX001A> hgyx001As, HGKC004 hgkc004) {
//查询打包单明细
List<Long> sourceIds = hgyx001As.stream().map(HGYX001A::getSourceId).collect(Collectors.toList());
List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds,true);
for (HGYX001A hgyx001A : hgyx001As) {
// 2 打包单 1 实时库存
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(hgkc004.getCompanyCode(), hgkc004.getWhCode(), hgyx001A.getInventCode());
if (hgkc010 == null) {
throw new PlatException("库存不足!");
......@@ -277,6 +284,8 @@ public class ServiceHGYX001 extends ServiceEPBase {
if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法保存!");
}
}
this.addHGKC004A(hgyx001A,hgkc004);
}
}
......@@ -296,6 +305,8 @@ public class ServiceHGYX001 extends ServiceEPBase {
hgkc004A.setWeight(hgyx001A.getWeight());
hgkc004A.setParentId(hgkc004.getId());
hgkc004A.setInventTypeDetail(hgyx001A.getInventTypeDetail());
hgkc004A.setSource(hgyx001A.getSource());
hgkc004A.setSourceId(hgyx001A.getSourceId());
DaoUtils.insert(HGKC004A.INSERT, hgkc004A);
}
......@@ -304,6 +315,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) map.get("sourceIds")).collect(Collectors.toList());
List<HGKC016A> hgkc016as = HGKCTools.HgKc016a.getById(sourceIds,true);
for (Map queryRow:queryBlock) {
HGYX001 hgyx001 = new HGYX001();
hgyx001.fromMap(queryRow);
......@@ -317,6 +331,11 @@ public class ServiceHGYX001 extends ServiceEPBase {
HGYX001A hgyx001A = new HGYX001A();
hgyx001A.fromMap(resultRow);
hgyx001A.setParentId(hgyx001.getId());
// 2 打包单 1 实时库存
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("库存不足!");
......@@ -324,6 +343,7 @@ public class ServiceHGYX001 extends ServiceEPBase {
if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法保存!");
}
}
if (hgyx001A.getId() == null || hgyx001A.getId() == 0) {
this.addDatail(hgyx001A);
this.addHGKC004A(hgyx001A, hgkc004);
......@@ -336,6 +356,11 @@ public class ServiceHGYX001 extends ServiceEPBase {
HGYX001A hgyx001A = new HGYX001A();
hgyx001A.fromMap(resultRow);
hgyx001A.setParentId(hgyx001.getId());
// 2 打包单 1 实时库存
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("库存不足!");
......@@ -343,6 +368,7 @@ public class ServiceHGYX001 extends ServiceEPBase {
if (hgkc010.getInvQty().compareTo(hgyx001A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法保存!");
}
}
if (hgyx001A.getId() == null || hgyx001A.getId() == 0) {
this.addDatail(hgyx001A);
}else {
......
package com.baosight.hggp.hg.yx.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.domain.HGKC016;
import com.baosight.hggp.hg.kc.domain.HGKC016A;
import com.baosight.hggp.hg.kc.domain.HGKC017;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ006;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.yx.domain.HGYX001;
import com.baosight.hggp.hg.yx.domain.HGYX001C;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/10/26
* @description
*/
public class ServiceHGYX001D extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.INVENT_TYPE_BLOCK_ID,
DdynamicEnum.INVENT_RECORD_BLOCK_ID,
DdynamicEnum.SPEC_NAME_BLOCK_ID),
new HashMap<String, Object>(){{
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeFour());
}});
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGYX001C().eiMetadata);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
Map qaramMap = EiInfoUtils.getFirstRow(inInfo);
qaramMap.put(HGYX001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
//qaramMap.put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeFour());
if (qaramMap.containsKey("specIds")) {
String[] specIdArray = qaramMap.get("specIds").toString().split(",");
qaramMap.put("notSpecIds",specIdArray);
}
return super.query(inInfo, "HGYX001D.query");
}
}
......@@ -242,6 +242,8 @@ public class ServiceHGYX002 extends ServiceEPBase {
hgkc004A.setWeight(hgyx002A.getReturnWeight());
hgkc004A.setParentId(hgkc004.getId());
hgkc004A.setInventTypeDetail(hgyx002A.getInventTypeDetail());
hgkc004A.setSource(hgyx002A.getSource());
hgkc004A.setSourceId(hgyx002A.getSourceId());
DaoUtils.insert(HGKC004A.INSERT, hgkc004A);
}
......
......@@ -27,7 +27,9 @@
UNIT_WEIGHT as "unitWeight", <!-- 发货单重 -->
WEIGHT as "weight", <!-- 发货重量 -->
PARENT_ID as "parentId", <!-- 销售发货ID -->
INVENT_TYPE_DETAIL as "inventTypeDetail"
INVENT_TYPE_DETAIL as "inventTypeDetail",
SOURCE as "source",
SOURCE_ID as "sourceId"
</sql>
<sql id="condition">
......@@ -101,6 +103,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
SOURCE = #source#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sourceId">
SOURCE_ID = #sourceId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="HGYX001A">
......@@ -148,12 +156,14 @@
UNIT_WEIGHT, <!-- 发货单重 -->
WEIGHT, <!-- 发货重量 -->
PARENT_ID, <!-- 销售发货ID -->
INVENT_TYPE_DETAIL
INVENT_TYPE_DETAIL,
SOURCE,
SOURCE_ID
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #inventRecordId#, #inventType#, #inventCode#,
#inventName#, #specId#, #spec#, #length#, #width#, #thick#, #quantity#, #unitWeight#,
#weight#, #parentId#,#inventTypeDetail#)
#weight#, #parentId#,#inventTypeDetail#, #source#, #sourceId#)
</insert>
<delete id="delete">
......@@ -205,7 +215,9 @@
UNIT_WEIGHT = #unitWeight#, <!-- 发货单重 -->
WEIGHT = #weight#, <!-- 发货重量 -->
PARENT_ID = #parentId#, <!-- 销售发货ID -->
INVENT_TYPE_DETAIL = #inventTypeDetail#
INVENT_TYPE_DETAIL = #inventTypeDetail#,
SOURCE = #source#,
SOURCE_ID = #sourceId#
WHERE
ID = #id#
</update>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HGYX001D">
<sql id="column">
A.ID as "id",
A.PARENT_ID as "parentId", <!-- 打包库存ID -->
A.PACK_CODE as "packCode", <!-- 打包单号 -->
A.INVENT_TYPE as "inventType", <!-- 存货类型 -->
A.INVENT_CODE as "inventCode", <!-- 存货编码 -->
A.INVENT_NAME as "inventName", <!-- 存货名称 -->
A.SPEC_ID as "specId", <!-- 规格ID -->
A.SPEC as "spec", <!-- 规格 -->
A.MATERIAL as "material", <!-- 材质 -->
A.UNIT as "unit", <!-- 单位 -->
A.LENGTH as "length", <!-- 长度 -->
A.WIDTH as "width", <!-- 宽度 -->
A.THICK as "thick", <!-- 厚度 -->
A.PACK_WAY as "packWay", <!-- 打包方式 -->
A.INV_QTY as "consQuantity", <!-- 库存数量 -->
A.INV_UNIT_WEIGHT as "consUnitWeight", <!-- 库存单重 -->
A.INV_WEIGHT as "consWeight", <!-- 库存重量 -->
A.INVENT_TYPE_DETAIL as "inventTypeDetail" <!-- 存货类型大类 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
B.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
B.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
B.DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
B.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
B.COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
B.WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
B.WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
B.INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
B.INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
B.INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="specId">
B.SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
B.SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
B.UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
B.LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="width">
B.WIDTH = #width#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="thick">
B.THICK = #thick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invUnitWeight">
INV_UNIT_WEIGHT = #invUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invWeight">
INV_WEIGHT = #invWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
B.INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="ids">
A.ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="notSpecIds">
B.SPEC_ID NOT IN <iterate close=")" open="(" conjunction="," property="notSpecIds">#notSpecIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
B.INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetails">
B.INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.yx.domain.HGYX001C">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC016A A
JOIN ${hggpSchema}.HGKC016 B ON A.PARENT_ID = B.ID
WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${hggpSchema}.HGKC016A A
JOIN ${hggpSchema}.HGKC016 B ON A.PARENT_ID = B.ID
WHERE 1=1
<include refid="condition" />
</select>
</sqlMap>
\ No newline at end of file
......@@ -30,7 +30,9 @@
RETURN_QUANTITY as "returnQuantity", <!-- 退货数量 -->
RETURN_WEIGHT as "returnWeight", <!-- 退货重量 -->
PARENT_ID as "parentId", <!-- 销售退货ID -->
INVENT_TYPE_DETAIL as "inventTypeDetail"
INVENT_TYPE_DETAIL as "inventTypeDetail",
SOURCE as "source",
SOURCE_ID as "sourceId"
</sql>
<sql id="condition">
......@@ -116,6 +118,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
SOURCE = #source#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sourceId">
SOURCE_ID = #sourceId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="HashMap" resultClass="HGYX002A">
......@@ -165,12 +173,14 @@
RETURN_QUANTITY, <!-- 退货数量 -->
RETURN_WEIGHT, <!-- 退货重量 -->
PARENT_ID, <!-- 销售退货ID -->
INVENT_TYPE_DETAIL
INVENT_TYPE_DETAIL,
SOURCE,
SOURCE_ID
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#, #length#,
#width#, #thick#, #quantity#, #unitWeight#, #weight#, #returnQuantity#, #returnWeight#,
#parentId#,#inventTypeDetail#)
#parentId#,#inventTypeDetail#, #source#, #sourceId#)
</insert>
<delete id="delete">
......@@ -204,7 +214,9 @@
RETURN_QUANTITY = #returnQuantity#, <!-- 退货数量 -->
RETURN_WEIGHT = #returnWeight#, <!-- 退货重量 -->
PARENT_ID = #parentId#, <!-- 销售退货ID -->
INVENT_TYPE_DETAIL = #inventTypeDetail#
INVENT_TYPE_DETAIL = #inventTypeDetail#,
SOURCE = #source#,
SOURCE_ID = #sourceId#
WHERE
ID = #id#
</update>
......
......@@ -27,7 +27,9 @@
'0' as "returnQuantity", <!-- 退货数量 -->
'0' as "returnWeight", <!-- 退货重量 -->
A.PARENT_ID as "parentId", <!-- 销售退货ID -->
A.INVENT_TYPE_DETAIL as "inventTypeDetail"
A.INVENT_TYPE_DETAIL as "inventTypeDetail",
A.SOURCE as "source",
A.SOURCE_ID as "sourceId"
</sql>
<sql id="authCondition">
<!-- 无权限时使用 -->
......@@ -125,6 +127,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails">
A.INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
A.SOURCE = #source#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sourceId">
A.SOURCE_ID = #sourceId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="HGYX002C">
......
......@@ -69,6 +69,11 @@
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -3,15 +3,14 @@ $(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
columns: [{
columns: [ {
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (!isBlank(item.id)){
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ')" >发货详情</a>';
+ 'onclick="showDetail(' + item.id + ',\''+item.inventCode+'\')" >详情</a>';
}
return template;
}
......@@ -69,12 +68,11 @@ let initInventCode = function () {
/**
* 显示详情
*/
function showDetail(id) {
function showDetail(id,inventCode) {
JSColorbox.open({
href: "HGKC016A?methodName=initLoad&inqu_status-0-parentId=" + id,
href: "HGKC016A?methodName=initLoad&inqu_status-0-inventCode="+inventCode+"&inqu_status-0-parentId="+id,
title: "<div style='text-align: center;'>详情</div>",
width: "80%",
height: "80%",
callbackName: windowCallback
});
}
\ No newline at end of file
......@@ -43,6 +43,7 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" width="120" enable="false" align="center"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
......@@ -60,7 +61,7 @@
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invWeight" cname="库存总重(KG)" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center" hidden="true"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
......
$(function () {
// 查询
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
$("#BNT_CHOICE").on("click", choice)
})
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [{
field: "operator",
title: "操作",
template: function (item) {
let template = '';
if (!isBlank(item.parentId)) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',' + item.invQty + ')" >拆单</a>';
}
return template;
}
}],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "打包单详情" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "invQty") {
let item = e.items[0];
let invWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', invWeight);
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
IPLATUI.EFWindow = {
"HGKC016B": {
close: function (e) {
// 刷新结果列表
query();
}
}
}
downKeyUp();
});
/**
* 查询
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
let choice = function () {
/**
* 显示详情
*/
function showDetail(id, invQty) {
JSColorbox.open({
href: "HGKC016B?methodName=initLoad&inqu_status-0-id="+id+"&inqu_status-0-invQty="+invQty,
title: "<div style='text-align: center;'>拆单</div>",
width: "80%",
height: "80%",
callbackName: Callback
});
}
/**
* 挑选库存回调
*/
let Callback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
parent.JSColorbox.setValueCallback(rows);
parent.JSColorbox.close();
let flag = true;
$.each(rows, function(index, item) {
let invQty = item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"数量\",不能为空并且大于0!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC016A", "save", true,
function (e) {
if (e.getStatus()!==-1){
btnNode.attr("disabled", false);
query();
}
});
}
});
}
}
\ No newline at end of file
......@@ -14,52 +14,35 @@
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="发货明细">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventName" cname="物料名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="spec" cname="规格" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" type="hidden" required="true" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" type="hidden" required="true" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFPage title="打包库存明细">
<EF:EFRegion id="result" title="记录集">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventCode" cname="产品编码" type="hidden" colWidth="3"/>
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" width="120" enable="false" align="center"/>
<EF:EFColumn ename="inventType" cname="存货类型" hidden="true"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="120"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="120"/>
<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
blockName="spec_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="打包单位" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="consQuantity" cname="数量" width="120" enable="true" format="{0:N0}" editType="text"
<EF:EFColumn ename="inventCode" cname="产品编码" enable="false" width="120"/>
<EF:EFColumn ename="inventName" cname="产品名称" enable="false" width="120"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" />
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="unit" cname="打包单位" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="invQty" cname="数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="consUnitWeight" cname="单重(KG)" width="120" enable="true" format="{0:N3}" editType="text"
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" width="120" enable="true" format="{0:N3}" editType="text" hidden="true"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="consWeight" cname="重量(KG)" width="120" enable="false" format="{0:N3}" editType="text"
<EF:EFColumn ename="invWeight" cname="打包重量(KG)" width="120" enable="false" format="{0:N3}" editType="text" hidden="true"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="packQuantity" cname="打包数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......
$(function () {
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "打包单详情" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "invQty") {
let item = e.items[0];
let invWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', invWeight);
}
});
},
onAdd: function (e) {
let list = resultGrid.getDataItems();
$.each(e.items, function (index, item) {
let num= list.length;
if (num > 0){
item['id'] = 0;
item['inventType'] = list[num-1].inventType;
item['inventTypeDetail'] = list[num-1].inventTypeDetail;
item['inventCode'] = list[num-1].inventCode;
item['inventName'] = list[num-1].inventName;
item['spec'] = list[num-1].spec;
item['specId'] = list[num-1].specId;
item['length'] = list[num-1].length;
item['width'] = list[num-1].width;
item['thick'] = list[num-1].thick;
item['unit'] = list[num-1].unit;
item['invQty'] = 0;
item['invUnitWeight'] = list[num-1].invUnitWeight;
item['invWeight'] = 0;
item['parentId'] = list[num-1].parentId;
item['packCode'] = list[num-1].packCode;
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
let invQty = $("#inqu_status-0-invQty").val();
let sum = 0;
$.each(rows, function(index, item) {
let invQty = item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"数量\",不能为空并且大于0!");
flag = false;
return false;
}
sum += parseFloat(invQty);
});
if (sum > invQty || sum < invQty){
message("选中的总数量不能大于或小于" + invQty);
flag = false;
}
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC016B", "save", true,
function (e) {
if (e.getStatus()!==-1){
parent.JSColorbox.setValueCallback(e);
}
});
}
});
}
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/10/26
Time: 9:06
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="打包库存明细拆单">
<EF:EFRegion id="inqu" title="基本信息">
<div class="row">
<EF:EFInput ename="inqu_status-0-invQty" cname="拆单数量" colWidth="3" type="text" />
<EF:EFInput blockId="inqu_status" row="0" ename="id" cname="id" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="inventType" cname="存货类型" hidden="true"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="产品编码" enable="false" width="120"/>
<EF:EFColumn ename="inventName" cname="产品名称" enable="false" width="120"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" />
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="unit" cname="打包单位" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="invQty" cname="数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0.000" sort="true" align="right" sumType="page"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" width="120" enable="true" format="{0:N3}" editType="text" hidden="true"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="invWeight" cname="打包重量(KG)" width="120" enable="false" format="{0:N3}" editType="text" hidden="true"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -8,6 +8,7 @@ $(function () {
$("#QUERY").on("click", query);
$("#BNT_SUBMIT").on("click", updateStatus);
IPLATUI.EFAutoComplete = {
"inqu_status-0-deviceName": {
......@@ -31,11 +32,10 @@ $(function () {
field: "operator",
title: "操作",
template: function (item) {
let auditStatus = item.deviceStatus;
let template = '';
if (item.companyCode && item.groupCode) {
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ',\''+item.inventCode+'\')" >详情</a>';
+ 'onclick="showDetail(' + item.id + ',\''+item.inventCode+'\',\''+item.packCode+'\',\''+item.unit+'\')" >详情</a>';
}
return template;
}
......@@ -94,13 +94,14 @@ $(function () {
title: "产品名称",
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whType", options.model["companyCode"]);
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HGKC010");
inInfo.set("methodName", "queryInventCodeBox");
inInfo.set("blockId", "invent_code_box_block_id");
inInfo.set("field", options.field);
inventRecordBox = refreshSelect(container, inInfo);
inventRecordBox = refreshSelect1(container, inInfo);
}
},{
field: "packUserId",
......@@ -212,8 +213,10 @@ let save = function (btnNode) {
$.each(rows, function(index, item) {
let companyCode= item.get("companyCode");
let projCode= item.get("projCode");
let whCode= item.get("whCode");
let inventCode= item.get("inventCode");
let packDate= item.get("packDate");
let invQty = item.get("invQty");
let packUserId= item.get("packUserId");
if(isBlank(companyCode)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!");
......@@ -225,6 +228,11 @@ let save = function (btnNode) {
flag = false;
return false;
}
if(isBlank(whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventCode)){
message("选中的第"+(index+1)+"行\"产品名称\",不能为空!");
flag = false;
......@@ -235,6 +243,11 @@ let save = function (btnNode) {
flag = false;
return false;
}
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"数量\",不能为空并且大于0!");
flag = false;
return false;
}
if(isBlank(packUserId)){
message("选中的第"+(index+1)+"行\"打包人员\",不能为空!");
flag = false;
......@@ -290,9 +303,9 @@ function updateStatus() {
/**
* 显示详情
*/
function showDetail(id,inventCode) {
let url = "HGKC017A?methodName=initLoad&inqu_status-0-inventCode="+inventCode+"&inqu_status-0-parentId="+id;
//window.open(url);
function showDetail(id,inventCode,packCode,unit) {
let url = "HGKC017A?methodName=initLoad&inqu_status-0-inventCode="+inventCode+
"&inqu_status-0-parentId="+id+"&inqu_status-0-packCode="+packCode+"&inqu_status-0-unit="+unit;
JSColorbox.open({
href: url,
title: "<div style='text-align: center;'>详情</div>",
......
......@@ -38,35 +38,36 @@
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" width="120" enable="false" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称" enable="true" width="160" align="center"
<EF:EFComboColumn ename="companyCode" cname="公司名称" enable="true" width="160" align="center" required="true"
blockName="roleCompany" textField="companyName" valueField="companyCode">
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="130" align="center" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" enable="true" width="160" align="center"
<EF:EFComboColumn ename="projCode" cname="项目名称" enable="true" width="160" align="center" required="true"
blockName="proj_record_block_id" textField="textField" valueField="valueField">
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" enable="true" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="packDate" cname="打包日期" enable="true" width="100" align="center" editType="date"
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="true" width="160" align="center" required="true"
blockName="wh_record_block_id" textField="textField" valueField="valueField">
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" enable="true" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="packDate" cname="打包日期" enable="true" width="100" align="center" editType="date" required="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="packCode" cname="打包单号" enable="false" width="130" align="center"/>
<EF:EFComboColumn cname="打包类型" ename="packType" width="100" align="center" required="false" enable="true" defaultValue="1">
<EF:EFCodeOption codeName="hggp.kc.packType" />
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="产品名称" enable="true" width="160" align="center"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#"
blockName="invent_code_box_block_id" textField="textField" valueField="valueField">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="产品名称" enable="true" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="产品编码" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventName" cname="产品名称" enable="true" width="140" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="true" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" 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}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="unit" cname="打包单位" enable="true" width="80" align="center"/>
<EF:EFColumn ename="invQty" cname="打包数量" enable="true" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="invQty" cname="打包数量" enable="true" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" enable="true" width="120" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="invWeight" cname="打包总重(KG)" enable="true" width="120" align="right" format="{0:N3}" hidden="true"/>
<EF:EFComboColumn ename="packUserId" cname="打包人员" enable="true" width="100" align="center" defaultValue="${loginName}"
<EF:EFComboColumn ename="packUserId" cname="打包人员" enable="true" width="100" align="center" defaultValue="${loginName}" required="true"
blockName="user_block_id" textField="textField" valueField="valueField"/>
<EF:EFColumn ename="packUserName" cname="打包人员名称" enable="true" width="120" align="center" hidden="true"/>
<EF:EFComboColumn cname="提交状态" ename="status" width="90" align="center" required="false" enable="false" defaultValue="0">
......
$(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var projRecordBox = __eiInfo.getBlock("proj_record_block_id").getMappedRows();
var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows();
var inventRecordBox = __eiInfo.getBlock("invent_code_box_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
],
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "打包单详情" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function(grid) {
//console.log(dayjs,"dayjs")
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "invQty") {
let item = e.items[0];
let invWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', invWeight);
}
});
},
onAdd: function (e) {
let info = new EiInfo();
info.set("inqu_status-0-inventCode", $("#inqu_status-0-inventCode").val())
info.set("inqu_status-0-whCode", $("#inqu_status-0-whCode").val());
info.set("inqu_status-0-companyCode", $("#inqu_status-0-companyCode").val());
EiCommunicator.send("HGKC017A", "getOnt", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
$.each(e.items, function (index, item) {
let list = ei.getBlock("detail").getMappedRows();
if (list.length > 0){
item['inventType'] = list[0].inventType;
item['inventTypeDetail'] = list[0].inventTypeDetail;
item['inventCode'] = list[0].inventCode;
item['inventName'] = list[0].inventName;
item['spec'] = list[0].spec;
item['specId'] = list[0].specId;
item['length'] = list[0].length;
item['width'] = list[0].width;
item['thick'] = list[0].thick;
item['unit'] = $("#inqu_status-0-unit").val();
item['invQty'] = 0;
item['invUnitWeight'] = list[0].invUnitWeight;
item['invWeight'] = 0;
item['packQuantity'] = 1;
}
item['parentId'] = $("#inqu_status-0-parentId").val();
});
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
},{async: false});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let invQty = item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"数量\",不能为空并且大于0!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC017A", "save", true,
function (e) {
if (e.getStatus()!==-1){
btnNode.attr("disabled", false);
query();
}
});
}
});
}
}
\ No newline at end of file
......@@ -15,31 +15,25 @@
var ctx = "${ctx}";
</script>
<EF:EFPage title="打包详情">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventName" cname="产品名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="spec" cname="规格" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" type="hidden" required="true" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="packCode" cname="打包单号" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventCode" cname="产品编码" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="whCode" cname="仓库编码" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="unit" cname="打包方式" type="hidden" colWidth="3"/>
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="inventType" cname="存货类型" hidden="true"/>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="产品编码" enable="false" width="120"/>
<EF:EFColumn ename="inventName" cname="产品名称" enable="false" width="120"/>
<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
blockName="spec_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="unit" cname="打包单位" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" />
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="unit" cname="打包单位" enable="true" readonly="false" width="100" align="right" format="{0:N3}" />
<EF:EFColumn ename="invQty" cname="数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
......@@ -48,12 +42,12 @@
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="invWeight" cname="打包重量(KG)" width="120" enable="false" format="{0:N3}" editType="text"
<EF:EFColumn ename="invWeight" cname="打包重量(KG)" width="120" enable="false" format="{0:N3}" editType="text" hidden="true"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="packQuantity" cname="打包数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" readonly="true"
displayType="0" sort="true" align="right" readonly="true" hidden="true"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
</EF:EFGrid>
......
......@@ -46,6 +46,7 @@
filter="contains" readonly="true" required="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFComboColumn ename="projCode" enable="true" cname="项目名称" width="200" align="center"
filter="contains" readonly="true" required="true">
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField"/>
......@@ -70,6 +71,7 @@
blockName="wh_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="consWhName" cname="发货仓库" hidden="true"/>
<EF:EFColumn ename="consAddr" cname="发货地址" hidden="true" width="120" align="center"/>
<EF:EFColumn ename="consQuantity" cname="发货数量" enable="true" readonly="true" width="120" align="center" format="{0:N3}" data-rules="number"/>
<EF:EFColumn ename="consWeight" cname="发货重量" width="120" align="center" format="{0:N3}" data-rules="number"/>
......
......@@ -168,6 +168,11 @@ $(function() {
$("#BNT_CHOICE").on("click", detail);
/**
* 选择打包单
*/
$("#BNT_UNPACK").on("click", unpack);
/**
* 保存
*/
$("#btn_save").on("click",function(){
......@@ -373,7 +378,11 @@ function detail() {
}
JSColorbox.open({
href: "HGYX001C?methodName=initLoad&inqu_status-0-companyCode="+consCode+"&inqu_status-0-projCode="+projCode+"&inqu_status-0-whCode="+consWhCode+"&inqu_status-0-specIds="+ids.join(','),
href: "HGYX001C?methodName=initLoad" +
"&inqu_status-0-companyCode="+consCode+"" +
"&inqu_status-0-projCode="+projCode+"" +
"&inqu_status-0-whCode="+consWhCode+"" +
"&inqu_status-0-specIds="+ids.join(','),
title: "<div style='text-align: center;'>选择发货明细</div>",
width: "95%",
height: "95%",
......@@ -397,6 +406,8 @@ function detailCallback(result) {
result[i].unitWeight = result[i].consUnitWeight;
result[i].weight = result[i].consWeight;
result[i].inventRecordId = result[i].specId
result[i].sourceId = result[i].id
result[i].source = "1";
resultGrid.addRows(result[i]);
}
}
......@@ -414,6 +425,78 @@ function detailCallback(result) {
$("#inqu_status-0-consWeight").val(consWeight)
}
let unpack = function () {
let ids = [];
let rows = resultGrid.getDataItems();
if (rows.length > 0){
$.each(rows, function(index, item) {
ids.push(item.inventRecordId)
});
}
let projCode = $("#inqu_status-0-projCode").val();
if(isBlank(projCode)){
message("请选择项目!");
return false;
}
let consCode = $("#inqu_status-0-consCode").val();
if(isBlank(consCode)){
message("请选择发货方!");
return false;
}
let consWhCode = $("#inqu_status-0-consWhCode").val();
if(isBlank(consWhCode)){
message("请选择发货仓库!");
return false;
}
JSColorbox.open({
href: "HGYX001D?methodName=initLoad" +
"&inqu_status-0-companyCode="+consCode+"" +
"&inqu_status-0-projCode="+projCode+"" +
"&inqu_status-0-whCode="+consWhCode+"" +
"&inqu_status-0-specIds="+ids.join(','),
title: "<div style='text-align: center;'>选择打包单明细</div>",
width: "95%",
height: "95%",
callbackName: unpackCallback
});
}
function unpackCallback(result) {
let consQuantity = 0;
let consWeight = 0;
let rows = resultGrid.getDataItems();
if (result.length> 0) {
for (let i = 0; i < result.length; i++) {
let filters = rows.filter(row => row.inventCode == result[i].inventCode
&& row.spec == result[i].spec);
if (filters.length > 0){
message("无法重复添加!");
return false;
}
result[i].quantity = result[i].consQuantity;
result[i].unitWeight = result[i].consUnitWeight;
result[i].weight = result[i].consWeight;
result[i].inventRecordId = result[i].specId
result[i].sourceId = result[i].id
result[i].source = "2";
resultGrid.addRows(result[i]);
}
}
rows = resultGrid.getDataItems();
for (let i = 0; i < rows.length; i++) {
consQuantity += parseInt(rows[i].quantity);
consWeight += parseFloat(rows[i].weight);
}
//获取显示框的值
$("#inqu_status-0-consQuantity_textField").val(consQuantity)
$("#inqu_status-0-consQuantity").val(consQuantity)
$("#inqu_status-0-consWeight_textField").val(consWeight)
$("#inqu_status-0-consWeight").val(consWeight)
}
/**
* 表格变更事件
*/
......
......@@ -98,6 +98,11 @@
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
......
......@@ -111,6 +111,11 @@
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
// 查询
$("#QUERY").on("click", query);
$("#BNT_CHOICE").on("click", choice)
})
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
let choice = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
parent.JSColorbox.setValueCallback(rows);
parent.JSColorbox.close();
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/10/26
Time: 11:14
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="发货明细">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="inventName" cname="物料名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="spec" cname="规格" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" type="hidden" required="true" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" type="hidden" required="true" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" type="hidden" required="true" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="120"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="120"/>
<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
blockName="spec_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFColumn ename="length" cname="长度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚度(MM)" enable="true" readonly="true" width="100" align="right" format="{0:N3}" maxLength="10"/>
<EF:EFColumn ename="consQuantity" cname="数量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="consUnitWeight" cname="单重(KG)" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" readonly="true"
data-regex="/^-?[0-9]{1,20}([.][0-9]{1,3})?$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="consWeight" cname="重量(KG)" width="120" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -56,7 +56,6 @@
<EF:EFComboColumn ename="status" cname="审核状态" width="80" align="center" enable="false" defaultValue="0" required="true">
<EF:EFCodeOption codeName="hggp.hgyx.status" condition="ITEM_CODE IN ('0','1')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyCode" cname="公司编码" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="consWhCode" cname="仓库编码" hidden="true"/>
<EF:EFColumn ename="consWhName" cname="仓库名称" hidden="true"/>
......
......@@ -106,6 +106,12 @@ $(function() {
}
});
},
beforeEdit: function (e) {
let item = e.model;
if(item.source == '2'){
e.preventDefault();
}
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
......@@ -430,6 +436,8 @@ function detail() {
}
function detailCallback(result) {
let consQuantity = 0;
let consWeight = 0;
let rows = resultGrid.getDataItems();
if (result.length> 0) {
for (let i = 0; i < result.length; i++) {
......@@ -439,10 +447,29 @@ function detailCallback(result) {
message("无法重复添加!");
return false;
}
if (result[i].source == 2){
result[i].set("returnQuantity", convertToNegative(result[i].quantity));
result[i].set("returnWeight", convertToNegative(result[i].weight));
}else {
result[i].set("returnQuantity", 0);
result[i].set("returnWeight", 0);
}
resultGrid.addRows(result[i]);
}
rows = resultGrid.getDataItems();
for (let i = 0; i < rows.length; i++) {
consQuantity += parseInt(rows[i].returnQuantity);
consWeight += parseFloat(rows[i].returnWeight);
}
//获取显示框的值
$("#inqu_status-0-returnQuantity_textField").val(convertToNegative(consQuantity))
$("#inqu_status-0-returnQuantity").val(convertToNegative(consQuantity))
$("#inqu_status-0-returnWeight_textField").val(convertToNegative(consWeight))
$("#inqu_status-0-returnWeight").val(convertToNegative(consWeight))
}
}
......
......@@ -106,6 +106,11 @@
data-regex="/^-?[0-9]{1,15}$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="returnWeight" cname="退货重量(KG)" width="120" defaultValue="0" enable="false" readonly="true" format="{0:N3}" editType="number" required="true"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
......
......@@ -99,6 +99,11 @@
displayType="0.000" sort="true" align="right"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -65,6 +65,11 @@
data-regex="/^-?[0-9]{1,15}$/" maxLength="20" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFColumn ename="returnWeight" cname="退货重量(KG)" width="120" enable="true" hidden="true" format="{0:N3}" editType="number" required="true"/>
<EF:EFComboColumn ename="source" cname="数据来源" width="120" align="center" filter="contains">
<EF:EFOption label="综合库存" value="1"/>
<EF:EFOption label="打包单" value="2"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sourceId" cname="数据来源ID" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -200,6 +200,42 @@ function refreshSelect(container, inInfo) {
}
/**
* 刷新下拉框
*
* @param container
* @param inInfo
*/
function refreshSelect1(container, inInfo) {
let grid = container.closest(".k-grid").data("kendoGrid");
let cellIndex = grid.cellIndex(container);
let input = $('<input />');
let field = inInfo.get("field");
input.attr("name", field);
input.attr("id", field);
input.appendTo(container);
let dataSource;
let serviceName = inInfo.get("serviceName");
let methodName = inInfo.get("methodName");
let blockId = inInfo.get("blockId");
EiCommunicator.send(serviceName, methodName, inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock(blockId).getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#:valueField#-#:textField#",
filter: "contains"
});
return dataSource;
}
/**
* 刷新下拉框,可手动输入
*
* @param container
......
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