Commit 0f73fa72 by liuyang

2024-10-14 采购合同详情录入长、宽、厚,规格自动带出,修改长、宽、厚回写规格

parent 15696bae
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cg.service;
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.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
......@@ -13,6 +14,7 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User;
......@@ -25,10 +27,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author:songx
......@@ -105,6 +104,8 @@ public class ServiceHGCG002B extends ServiceBase {
this.editData(fCg002Bs, dbCg002);
} else {
// 写入数据
List<String> inventCodes = ObjectUtils.listEpKey(fCg002Bs, HGCG002B.FIELD_INVENT_CODE);
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.list(inventCodes);
for (HGCG002B fCg002B : fCg002Bs) {
if (fCg002B.getId() == null || fCg002B.getId() == 0) {
this.saveData(fCg002B, dbCg002);
......@@ -112,6 +113,22 @@ public class ServiceHGCG002B extends ServiceBase {
fCg002B.setStatus(HGConstant.CgContractStatus.S_0);
DaoUtils.update(HGCG002B.UPDATE, fCg002B);
}
if (Objects.nonNull(hgpz005List)){
hgpz005List.stream().filter(hgpz005 -> hgpz005.getInventCode().equals(fCg002B.getInventCode()))
.forEach(hgpz005 -> {
if (!hgpz005.getLength().equals(fCg002B.getLength()) ||
!hgpz005.getWidth().equals(fCg002B.getWidth()) ||
!hgpz005.getThick().equals(fCg002B.getThick())){
hgpz005.setLength(fCg002B.getLength());
hgpz005.setWidth(fCg002B.getWidth());
hgpz005.setThick(fCg002B.getThick());
hgpz005.setSpec(HGPZTools.HgPz005.jointSpec(fCg002B.getLength(), fCg002B.getWidth(), fCg002B.getThick()));
}else if (!hgpz005.getSpec().equals(fCg002B.getSpec())){
hgpz005.setSpec(fCg002B.getSpec());
}
DaoUtils.update(HGPZ005.UPDATE, hgpz005);
});
}
}
// 修改主表信息
dbCg002.setStatus(HGConstant.CgContractStatus.S_0);
......
......@@ -8,7 +8,8 @@ $(function () {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [{
columns: [
{
field: "inventCode",
template: function (item) {
let template = item.inventCode;
......@@ -49,36 +50,36 @@ $(function () {
filter: "contains"
});
}
}, {
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if (purUserName) {
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}, {
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if (purUserName) {
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
}
}
return dataItem["purUserName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
return dataItem["purUserName"];
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}
],
beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val();
......@@ -143,6 +144,13 @@ $(function () {
if (e.field == "calculationMethod") {
calAmount(item);
}
if (e.field == "length" || e.field == "width" || e.field == "thick"){
let length = e.items[0].length;
let width = e.items[0].width;
let thick = e.items[0].thick;
let spec = `${length}*${width}*${thick}`;
resultGrid.setCellValue(e.items[0], 'spec', spec);
}
if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
......@@ -291,28 +299,38 @@ let save = function () {
message("请选择数据");
return;
}
let flag = true;
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['inventCode'])) {
message("勾选的第" + (i + 1) + "行存货编码不能为空");
flag = false;
return;
}
if(isBlank(rows[i]['price']) || !isNumber(rows[i]['price'])){
message("勾选的第" + (i + 1) + "行单价不能小于0");
flag = false;
return;
}
if(isBlank(rows[i]['taxRate']) || !isNumber(rows[i]['taxRate'])){
message("勾选的第" + (i + 1) + "行税率不能为空");
flag = false;
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002B", "save",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002B", "save",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
}
);
}
});
);
}
});
}
}
/**
......
......@@ -14,7 +14,7 @@
<div class="row">
<EF:EFSelect cname="存货编号" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="" template="[#=valueField#]#=textField#">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_box_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains" template="[#=valueField#]#=textField#">
<EF:EFOption label="全部" value=""/>
......@@ -26,7 +26,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="inventCode" required="true" cname="存货编号"/>
<EF:EFColumn ename="inventCode" required="true" cname="存货编号" width="160"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
......
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