Commit 0e5411cf by 江和松

页面计算逻辑处理

parent 1427b410
......@@ -3,10 +3,11 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.sc.domain.HGSC003;
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.exception.PlatException;
......@@ -24,10 +25,12 @@ public class ServiceHGKC008A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGKC008A.QUERY, new HGKC008A());
String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_WH_CODE);
Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC008A.FIELD_WH_CODE, whCode);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),map,false
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.SPEC_BOX_BLOCK_ID),map,false
);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -38,10 +41,12 @@ public class ServiceHGKC008A extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGKC008A.QUERY, new HGKC008A());
String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_WH_CODE);
Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC008A.FIELD_WH_CODE, whCode);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),map,false
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.SPEC_BOX_BLOCK_ID),map,false
);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
......@@ -105,14 +110,12 @@ public class ServiceHGKC008A extends ServiceBase {
/**
* 校验保存的数据
*
* @param hgkc008
* @param hgkc008a
*/
private void checkSaveData(HGKC008A hgkc008) {
private void checkSaveData(HGKC008A hgkc008a) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgkc008.getCompanyCode(), "请选择公司!");
AssertUtils.isEmpty(hgkc008.getWhCode(), "请选择仓库信息!");
AssertUtils.isEmpty(hgkc008.getWhName(), "请选择仓库信息!");
AssertUtils.isNull(hgkc008a.getReceiveId(), "未获取到生产领料单ID信息");
}
}
......
......@@ -2,16 +2,20 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.sc.domain.HGSC001;
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.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -19,7 +23,7 @@ import java.util.Map;
* @date:2024/5/9,11:04
*/
public class ServiceHGKC010 extends ServiceBase {
/**
* 画面初始化
*
......@@ -41,7 +45,7 @@ public class ServiceHGKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 查询操作
*
......@@ -59,5 +63,44 @@ public class ServiceHGKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 实时库存下拉框
* @param inInfo
* @return
*/
public EiInfo queryInventCodeBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String whCode = MapUtils.getString(queryMap, HGKC010.FIELD_WH_CODE);
String inventType = MapUtils.getString(queryMap, HGKC010.FIELD_INVENT_TYPE);
Map map = new HashMap();
map.put(HGKC010.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC010.FIELD_WH_CODE, whCode);
map.put(HGKC010.FIELD_INVENT_TYPE, inventType);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID), map,false);
return inInfo;
}
/**
* 实时库存规格下拉框
* @param inInfo
* @return
*/
public EiInfo querySpecBox(EiInfo inInfo){
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String whCode = MapUtils.getString(queryMap, HGKC010.FIELD_WH_CODE);
String inventType = MapUtils.getString(queryMap, HGKC010.FIELD_INVENT_TYPE);
String inventCode = MapUtils.getString(queryMap, HGKC010.FIELD_INVENT_CODE);
Map map = new HashMap();
map.put(HGKC010.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC010.FIELD_WH_CODE, whCode);
map.put(HGKC010.FIELD_INVENT_TYPE, inventType);
map.put(HGKC010.FIELD_INVENT_CODE, inventCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_BOX_BLOCK_ID), map,false);
return inInfo;
}
}
......@@ -30,7 +30,7 @@ $(function (){
let template = '';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id +')" >领料详情</a>';
+ 'onclick="showDetail(' + item.id +',\''+item.whCode+'\')" >领料详情</a>';
if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateStatus(' + item.id + ',1)" >提交</a>';
......@@ -136,6 +136,9 @@ $(function (){
e.items[0].projName = "";
e.items[0].whCode = "";
e.items[0].whName = "";
loadChange(grid,e,"projName");
loadChange(grid,e,"whCode");
loadChange(grid,e,"whName");
loadChange(grid,e,"projCode");
}
if (e.field == "whCode") {
......@@ -221,9 +224,9 @@ function updateStatus(id,status) {
/**
* 显示详情
*/
function showDetail(id) {
function showDetail(id,whCode) {
JSColorbox.open({
href: "HGKC008A?methodName=initLoad&inqu_status-0-receiveId=" + id,
href: "HGKC008A?methodName=initLoad&inqu_status-0-receiveId=" + id+"&inqu_status-0-whCode="+whCode,
title: "<div style='text-align: center;'>领料详情</div>",
width: "80%",
height: "80%",
......
......@@ -35,7 +35,7 @@
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="130" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false" required="true"/>
<EF:EFColumn ename="applyCode" cname="生产领料单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
......
$(function (){
var inventRecordBoxBlocks = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
var inventRecordBoxBlocks = __eiInfo.getBlock("invent_code_box_block_id").getMappedRows();
var specBoxBlocks = __eiInfo.getBlock("spec_box_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
......@@ -27,7 +28,6 @@ $(function (){
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
item['inventName'] = inventRecordBoxBlocks[i]['textField'];
template = inventRecordBoxBlocks[i]['valueField'];
}
}
......@@ -36,13 +36,13 @@ $(function (){
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_record_block_id").getMappedRows();
dataSource = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
......@@ -64,27 +64,49 @@ $(function (){
}
},
{
field: "invQty",
title: "数量",
field: "invSpec",
template: function (item) {
if(item.invQty && item.invUnitWeight){
let totalWeight = item.invQty * item.invUnitWeight;
item['invWeight'] = totalWeight;
let template = "";
if(item.invSpec){
for(let i=0;i<specBoxBlocks.length;i++){
if(item.invSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
}
}
}
return item.invQty;
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGKC010", "querySpecBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("spec_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},
{
field: "price",
title: "单价",
template: function (item) {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
item['amount'] = totalAmount;
}
return item.invQty;
}
},{
field: "receiveId",
template: function (item) {
item['receiveId'] =$("#inqu_status-0-receiveId").val();
......@@ -96,6 +118,65 @@ $(function (){
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
var item = e.items[0];
//数量计算
if (e.field == "invQty") {
if(item.invQty && item.invUnitWeight){
let totalWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', totalWeight)
}
}
//单价计算
if (e.field == "price") {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
if (e.field == "inventType") {
resultGrid.setCellValue(item, 'inventCode', "")
resultGrid.setCellValue(item, 'inventName', "")
resultGrid.setCellValue(item, 'invSpec', "")
resultGrid.setCellValue(item, 'invLength', "")
resultGrid.setCellValue(item, 'invWidth', "")
resultGrid.setCellValue(item, 'invThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"inventCode");
}
if (e.field == "inventCode") {
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField'])
}
}
resultGrid.setCellValue(item, 'invSpec', "")
resultGrid.setCellValue(item, 'invLength', "")
resultGrid.setCellValue(item, 'invWidth', "")
resultGrid.setCellValue(item, 'invThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"invSpec");
}
if (e.field == "invSpec") {
for(let i=0;i<specBoxBlocks.length;i++){
if(item.invSpec === specBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'invLength', specBoxBlocks[i]['param1Field'])
resultGrid.setCellValue(item, 'invWidth', specBoxBlocks[i]['param2Field'])
resultGrid.setCellValue(item, 'invThick', specBoxBlocks[i]['param3Field'])
resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param6Field'])
template = specBoxBlocks[i]['valueField'];
}
}
resultGrid.setCellValue(item, 'price', "")
resultGrid.setCellValue(item, 'amount', "")
loadChange(grid,e,"invQty");
}
});
},
afterEdit:function (e) {
......@@ -147,7 +228,7 @@ let save = function (btnNode) {
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC008", "save", true);
JSUtils.submitGridsData("result", "HGKC008A", "save", true);
btnNode.attr("disabled", false);
}
});
......
......@@ -13,18 +13,21 @@
<EF:EFPage title="生产领料详情">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-receiveId" cname="领料单id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_type_box_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput ename="inqu_status-0-inventCode" cname="存货编码" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-inventName" cname="存货名称" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="receiveId" cname="领料单id" hidden="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
......@@ -32,25 +35,24 @@
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" required="true"/>
<EF:EFColumn ename="invSpec" cname="规格" width="120" align="center" enable="false" />
<EF:EFColumn ename="invSpec" cname="规格" width="120" align="center" required="true" />
<EF:EFColumn ename="invLength" cname="长度(MM)" width="120" align="center" enable="false"/>
<EF:EFColumn ename="invWidth" cname="宽度(MM)" width="120" align="center" enable="false"/>
<EF:EFColumn ename="invThick" cname="厚度(MM)" width="120" align="center" enable="false"/>
<EF:EFColumn ename="invQty" cname="数量" enable="false" width="120" align="right" format="{0:N0}"
hidden="true"/>
<EF:EFColumn ename="invUnitWeight" cname="单重" width="100" enable="true" readonly="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
<EF:EFColumn ename="invQty" cname="数量" width="120" align="right" format="{0:N0}" enable="true" required="true" />
<EF:EFColumn ename="invUnitWeight" cname="单重" width="100" enable="false" readonly="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="invWeight" cname="重量" width="100" enable="true" readonly="true" format="{0:N3}" editType="text"
<EF:EFColumn ename="invWeight" cname="重量" width="100" enable="false" readonly="true" format="{0:N3}" editType="text"
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:EFColumn ename="price" cname="单价" width="100" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
displayType="0.000" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="amount" cname="金额" width="100" enable="true" format="{0:N3}" editType="text"
<EF:EFColumn ename="amount" cname="金额" width="100" enable="false" format="{0:N3}" editType="text"
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位小数!"/>
......
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