Commit cccf4025 by liuyang

2024-06-06 销售出库单-提交和调拨单逻辑调整

parent 30783bb0
...@@ -152,7 +152,7 @@ public enum DdynamicEnum { ...@@ -152,7 +152,7 @@ public enum DdynamicEnum {
* 用途:调拨单下拉框 * 用途:调拨单下拉框
* 编写:ly * 编写:ly
*/ */
INVENT_CODE_BOX_BLOCK_ID("invent_code_box_block_id", "inventCode", "inventName","inventType", "specId", "HGKC010.queryInventCodeBox"), INVENT_CODE_BOX_BLOCK_ID("invent_code_box_block_id", "inventCode", "inventName","inventType", "specId","spec","length","width","thick","invQty","invUnitWeight","invWeight", "HGKC010.queryInventCodeBox"),
/** /**
* 模块:从实时库存取规格信息 * 模块:从实时库存取规格信息
......
...@@ -87,6 +87,7 @@ public class HGKC010 extends DaoEPBase { ...@@ -87,6 +87,7 @@ public class HGKC010 extends DaoEPBase {
public static final String COUNT = "HGKC010.count"; public static final String COUNT = "HGKC010.count";
public static final String INSERT = "HGKC010.insert"; public static final String INSERT = "HGKC010.insert";
public static final String UPDATE = "HGKC010.update"; public static final String UPDATE = "HGKC010.update";
public static final String UPDATE_INV = "HGKC010.updateInv";
public static final String DELETE = "HGKC010.delete"; public static final String DELETE = "HGKC010.delete";
private Long id = new Long(0); private Long id = new Long(0);
......
...@@ -8,6 +8,8 @@ import com.baosight.hggp.hg.constant.HGConstant; ...@@ -8,6 +8,8 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC004; import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.kc.domain.HGKC004A; import com.baosight.hggp.hg.kc.domain.HGKC004A;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sb.domain.HGSB002; import com.baosight.hggp.hg.sb.domain.HGSB002;
...@@ -157,6 +159,25 @@ public class ServiceHGKC004 extends ServiceEPBase { ...@@ -157,6 +159,25 @@ public class ServiceHGKC004 extends ServiceEPBase {
HGKC004 hgkc004 = new HGKC004(); HGKC004 hgkc004 = new HGKC004();
hgkc004.fromMap(map); hgkc004.fromMap(map);
DaoUtils.update(HGKC004.UPDATE_STATUS, hgkc004); DaoUtils.update(HGKC004.UPDATE_STATUS, hgkc004);
HGKC004 kc004 = HGKCTools.HgKc004.getId(hgkc004.getId());
List<HGKC004A> hgkc004s = HGKCTools.HgKc004.getDetailById(hgkc004.getId());
AssertUtils.isEmpty(hgkc004s, "销售出库单明细不存在!");
for (HGKC004A hgkc004A : hgkc004s) {
HGKC010 hgkc010 = HGKCTools.HgKc010.get(kc004.getCompanyCode(), kc004.getWhCode(), hgkc004A.getInventRecordId());
if (hgkc010 == null) {
throw new PlatException("库存不足!");
}
if (hgkc010.getInvQty().compareTo(hgkc004A.getQuantity()) < 0) {
throw new PlatException("库存不足,无法提交!");
}else if (hgkc010.getInvQty().compareTo(hgkc004A.getQuantity()) == 0) {
hgkc010.setInvQty(BigDecimal.ZERO);
hgkc010.setInvWeight(BigDecimal.ZERO);
}else {
hgkc010.setInvQty(hgkc010.getInvQty().subtract(hgkc004A.getQuantity()));
hgkc010.setInvWeight(hgkc010.getInvQty().multiply(hgkc004A.getUnitWeight()));
}
DaoUtils.update(HGKC010.UPDATE_INV, hgkc010);
}
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
......
...@@ -218,7 +218,14 @@ ...@@ -218,7 +218,14 @@
INVENT_TYPE as "inventType", <!-- 存货类型 --> INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 --> INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 --> INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId" <!-- 规格ID --> SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
INV_QTY as "invQty", <!-- 库存数量 -->
INV_UNIT_WEIGHT as "invUnitWeight", <!-- 库存单重 -->
INV_WEIGHT as "invWeight" <!-- 库存重量 -->
FROM ${hggpSchema}.HGKC010 FROM ${hggpSchema}.HGKC010
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
......
...@@ -6,8 +6,6 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -6,8 +6,6 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
...@@ -260,6 +258,25 @@ public class HGKCTools { ...@@ -260,6 +258,25 @@ public class HGKCTools {
/** /**
* 查询销售出库信息 * 查询销售出库信息
* *
* @param id
* @return
*/
public static HGKC004 getId(Long id) {
if (StringUtils.isNull(id)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HGKC004> results = DaoBase.getInstance().query(HGKC004.QUERY, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.get(0);
}
/**
* 查询销售出库信息
*
* @param ids * @param ids
* @return * @return
*/ */
...@@ -272,10 +289,19 @@ public class HGKCTools { ...@@ -272,10 +289,19 @@ public class HGKCTools {
return DaoBase.getInstance().query(HGKC004.QUERY, queryMap); return DaoBase.getInstance().query(HGKC004.QUERY, queryMap);
} }
public static List<HGKC004A> getDetailById(Long parentId) {
if (StringUtils.isNull(parentId)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
return DaoBase.getInstance().query(HGKC004A.QUERY, queryMap);
}
/** /**
* 查询销售出库信息 * 查询销售出库信息
* *
* @param saleNos * @param saleNos 销售出库单号
* @return * @return
*/ */
public static List<HGKC004> list(List<String> saleNos) { public static List<HGKC004> list(List<String> saleNos) {
...@@ -443,6 +469,7 @@ public class HGKCTools { ...@@ -443,6 +469,7 @@ public class HGKCTools {
paramMap.put("companyCode", companyCode); paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode); paramMap.put("whCode", whCode);
paramMap.put("specId", specId); paramMap.put("specId", specId);
paramMap.put("deleteFlag", 0);
List<HGKC010> results = DaoBase.getInstance().query(HGKC010.QUERY, paramMap); List<HGKC010> results = DaoBase.getInstance().query(HGKC010.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
...@@ -474,7 +501,7 @@ public class HGKCTools { ...@@ -474,7 +501,7 @@ public class HGKCTools {
} }
/** /**
* HGKC010 工具类 * HGKC011 工具类
* *
* @author:songx * @author:songx
* @date:2024/5/9,14:33 * @date:2024/5/9,14:33
......
...@@ -211,6 +211,8 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -211,6 +211,8 @@ public class ServiceHGYX001 extends ServiceEPBase {
public void saveOutbound(Map resultRow, String outboundCode) { public void saveOutbound(Map resultRow, String outboundCode) {
// 写入数据 // 写入数据
HGKC004 hgkc004 = new HGKC004(); HGKC004 hgkc004 = new HGKC004();
String id = resultRow.get(HGYX001.FIELD_ID).toString();
hgkc004.setParentId(Long.parseLong(id));
hgkc004.setReceiptDate(DateUtils.formatShort(DateUtils.date())); hgkc004.setReceiptDate(DateUtils.formatShort(DateUtils.date()));
hgkc004.setCompanyCode(resultRow.get(HGYX001.FIELD_COMPANY_CODE).toString()); hgkc004.setCompanyCode(resultRow.get(HGYX001.FIELD_COMPANY_CODE).toString());
//hgkc004.setCompanyName(resultRow.get(HGYX001.FIELD_COMPANY_NAME).toString()); //hgkc004.setCompanyName(resultRow.get(HGYX001.FIELD_COMPANY_NAME).toString());
...@@ -274,6 +276,7 @@ public class ServiceHGYX001 extends ServiceEPBase { ...@@ -274,6 +276,7 @@ public class ServiceHGYX001 extends ServiceEPBase {
hgyx001.setStatus(1); hgyx001.setStatus(1);
this.add(hgyx001); this.add(hgyx001);
HGKC004 hgkc004 = new HGKC004(); HGKC004 hgkc004 = new HGKC004();
hgkc004.setParentId(hgyx001.getId());
hgkc004.setReceiptDate(DateUtils.formatShort(DateUtils.date())); hgkc004.setReceiptDate(DateUtils.formatShort(DateUtils.date()));
hgkc004.setCompanyCode(hgyx001.getCompanyCode()); hgkc004.setCompanyCode(hgyx001.getCompanyCode());
hgkc004.setWhCode(hgyx001.getConsWhCode()); hgkc004.setWhCode(hgyx001.getConsWhCode());
......
...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.kc.domain.HGKC010; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.yx.domain.HGYX001; import com.baosight.hggp.hg.yx.domain.HGYX001;
import com.baosight.hggp.hg.yx.domain.HGYX001C; import com.baosight.hggp.hg.yx.domain.HGYX001C;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -24,8 +25,11 @@ public class ServiceHGYX001C extends ServiceEPBase { ...@@ -24,8 +25,11 @@ public class ServiceHGYX001C extends ServiceEPBase {
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGYX001C.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGYX001C.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String[] specIds = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "specIds").split(","); String specIds = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "specIds");
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "specIds", specIds); if (StringUtils.isNotEmpty(specIds)) {
String[] specIdArray = specIds.split(",");
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "specIds", specIdArray);
}
inInfo = super.query(inInfo, HGYX001C.QUERY, new HGYX001C()); inInfo = super.query(inInfo, HGYX001C.QUERY, new HGYX001C());
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
Arrays.asList( Arrays.asList(
......
...@@ -7,7 +7,8 @@ $(function () { ...@@ -7,7 +7,8 @@ $(function () {
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
columns: [{ columns: [
{
field: "operator", field: "operator",
title: "操作", title: "操作",
template: function (item) { template: function (item) {
...@@ -45,6 +46,9 @@ $(function () { ...@@ -45,6 +46,9 @@ $(function () {
for (let i = 0; i < companyCodeBox.length; i++) { for (let i = 0; i < companyCodeBox.length; i++) {
if (calloutCompanyCode === companyCodeBox[i]['valueField']) { if (calloutCompanyCode === companyCodeBox[i]['valueField']) {
item['calloutCompanyName'] = companyCodeBox[i]['textField']; item['calloutCompanyName'] = companyCodeBox[i]['textField'];
if (!isBlank(item['allotType'])){
item['callinCompanyCode'] = companyCodeBox[i]['valueField'];
}
return companyCodeBox[i]['textField']; return companyCodeBox[i]['textField'];
} }
} }
...@@ -132,15 +136,17 @@ $(function () { ...@@ -132,15 +136,17 @@ $(function () {
if (e.field === "companyCode"){ if (e.field === "companyCode"){
loadChange(grid,e,"allotType"); loadChange(grid,e,"allotType");
}else if (e.field === "calloutCompanyCode") { }else if (e.field === "calloutCompanyCode") {
if (e.items[0]["allotType"] == 1){
e.items[0]["callinCompanyCode"] = e.items[0]["calloutCompanyCode"];
}
e.items[0]["calloutWhCode"]= ''; e.items[0]["calloutWhCode"]= '';
e.items[0]["calloutWhName"]= ''; e.items[0]["calloutWhName"]= '';
e.items[0]["callinCompanyCode"]= '';
e.items[0]["callinCompanyName"]= '';
e.items[0]["callinWhCode"] = ''; e.items[0]["callinWhCode"] = '';
e.items[0]["callinWhName"] = ''; e.items[0]["callinWhName"] = '';
loadChange(grid,e,"callinCompanyCode");
loadChange(grid,e,"calloutWhCode"); loadChange(grid,e,"calloutWhCode");
}else if (e.field == "calloutWhCode") { }else if (e.field == "calloutWhCode") {
if (e.items[0]["allotType"] == 2){ if (e.items[0]["allotType"] == 2 && isBlank(e.items[0]["callinCompanyCode"])){
e.items[0]["callinCompanyCode"]= ''; e.items[0]["callinCompanyCode"]= '';
loadChange(grid,e,"callinCompanyCode"); loadChange(grid,e,"callinCompanyCode");
}else if (e.items[0]["allotType"] == 1 && isBlank(e.items[0]["callinCompanyCode"])) { }else if (e.items[0]["allotType"] == 1 && isBlank(e.items[0]["callinCompanyCode"])) {
......
...@@ -106,8 +106,6 @@ $(function() { ...@@ -106,8 +106,6 @@ $(function() {
e.items[0]["quantity"] = specIdBox[i]['param4Field']; e.items[0]["quantity"] = specIdBox[i]['param4Field'];
resultGrid.setCellValue(e.items[0],"unitWeight",specIdBox[i]['param5Field']); resultGrid.setCellValue(e.items[0],"unitWeight",specIdBox[i]['param5Field']);
resultGrid.setCellValue(e.items[0],"weight",specIdBox[i]['param6Field']); resultGrid.setCellValue(e.items[0],"weight",specIdBox[i]['param6Field']);
//e.items[0]["unitWeight"] = specIdBox[i]['param5Field'];
//e.items[0]["weight"] = specIdBox[i]['param6Field'];
} }
} }
loadChange(grid,e,"length"); loadChange(grid,e,"length");
...@@ -122,7 +120,20 @@ $(function() { ...@@ -122,7 +120,20 @@ $(function() {
resultGrid.setCellValue(e.items[0],"weight",e.items[0].unitWeight*e.items[0].quantity); resultGrid.setCellValue(e.items[0],"weight",e.items[0].unitWeight*e.items[0].quantity);
} }
}else if (e.field === "inventCode"){ }else if (e.field === "inventCode"){
loadChange(grid,e,"spec"); for (let i = 0; i < inventCodedBox.length; i++) {
if (inventCodedBox[i]['valueField'] === e.items[0]["inventCode"]){
resultGrid.setCellValue(e.items[0],"inventType",inventCodedBox[i]['param1Field']);
resultGrid.setCellValue(e.items[0],"inventRecordId",inventCodedBox[i]['param2Field']);
resultGrid.setCellValue(e.items[0],"spec",inventCodedBox[i]['param3Field']);
resultGrid.setCellValue(e.items[0],"length",inventCodedBox[i]['param4Field']);
resultGrid.setCellValue(e.items[0],"width",inventCodedBox[i]['param5Field']);
resultGrid.setCellValue(e.items[0],"thick",inventCodedBox[i]['param6Field']);
resultGrid.setCellValue(e.items[0],"quantity",inventCodedBox[i]['param7Field']);
resultGrid.setCellValue(e.items[0],"unitWeight",inventCodedBox[i]['param8Field']);
resultGrid.setCellValue(e.items[0],"weight",inventCodedBox[i]['param9Field']);
}
}
loadChange(grid,e,"quantity");
} }
}); });
}, },
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" width="120" align="center" required="true" <EF:EFComboColumn ename="inventCode" cname="存货名称" enable="true" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_code_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains"> filter="contains">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="true" width="120" align="center" required="true" <EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" width="120" align="center" required="true"
blockName="invent_code_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains"> filter="contains">
</EF:EFComboColumn> </EF:EFComboColumn>
......
...@@ -344,9 +344,12 @@ let deleteFunc = function () { ...@@ -344,9 +344,12 @@ let deleteFunc = function () {
function detail() { function detail() {
let ids = []; let ids = [];
let rows = resultGrid.getDataItems(); let rows = resultGrid.getDataItems();
$.each(rows, function(index, item) { if (rows.length > 0){
ids.push(item.inventRecordId) $.each(rows, function(index, item) {
}); ids.push(item.inventRecordId)
});
}
JSColorbox.open({ JSColorbox.open({
href: "HGYX001C?methodName=initLoad&inqu_status-0-companyCode="+$("#inqu_status-0-consCode").val()+"&inqu_status-0-whCode="+$("#inqu_status-0-consWhCode").val()+"&inqu_status-0-specIds="+ids.join(','), href: "HGYX001C?methodName=initLoad&inqu_status-0-companyCode="+$("#inqu_status-0-consCode").val()+"&inqu_status-0-whCode="+$("#inqu_status-0-consWhCode").val()+"&inqu_status-0-specIds="+ids.join(','),
title: "<div style='text-align: center;'>选择发货明细</div>", title: "<div style='text-align: center;'>选择发货明细</div>",
......
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