Commit 64bb2fb2 by 江和松

生产领料单与明细根据状态判断字段是否能修改保存

parent fd0ebcc7
...@@ -43,7 +43,6 @@ $(function (){ ...@@ -43,7 +43,6 @@ $(function (){
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < companyCodes.length; i++) { for (let i = 0; i < companyCodes.length; i++) {
if (companyCodes[i]['valueField'] === dataItem['companyCode']){ if (companyCodes[i]['valueField'] === dataItem['companyCode']){
dataItem['companyName'] = companyCodes[i]['textField']
return companyCodes[i]['textField']; return companyCodes[i]['textField'];
} }
} }
...@@ -56,7 +55,6 @@ $(function (){ ...@@ -56,7 +55,6 @@ $(function (){
if(item.projCode){ if(item.projCode){
for(let i=0;i<projCodes.length;i++){ for(let i=0;i<projCodes.length;i++){
if(item.projCode === projCodes[i]['valueField']){ if(item.projCode === projCodes[i]['valueField']){
item['projName'] = projCodes[i]['textField'];
template = projCodes[i]['valueField']; template = projCodes[i]['valueField'];
} }
} }
...@@ -98,7 +96,6 @@ $(function (){ ...@@ -98,7 +96,6 @@ $(function (){
if(item.whCode){ if(item.whCode){
for(let i=0;i<whRecordBoxBlocks.length;i++){ for(let i=0;i<whRecordBoxBlocks.length;i++){
if(item.whCode === whRecordBoxBlocks[i]['valueField']){ if(item.whCode === whRecordBoxBlocks[i]['valueField']){
item['whName'] = whRecordBoxBlocks[i]['textField'];
template = whRecordBoxBlocks[i]['valueField']; template = whRecordBoxBlocks[i]['valueField'];
} }
} }
...@@ -135,25 +132,41 @@ $(function (){ ...@@ -135,25 +132,41 @@ $(function (){
// 此 grid 对象 // 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化 // 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
var item = e.items[0];
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field == "projCode") { if (e.field == "projCode") {
loadChange(grid,e,"projName"); for (let i = 0; i < projCodes.length; i++) {
if (projCodes[i]['valueField'] === item['projCode']){
resultGrid.setCellValue(item, 'projName', projCodes[i]['textField'])
}
}
} }
if (e.field == "companyCode") { if (e.field == "companyCode") {
e.items[0].projCode = ""; for (let i = 0; i < companyCodes.length; i++) {
e.items[0].projName = ""; if (companyCodes[i]['valueField'] === item['companyCode']){
e.items[0].whCode = ""; resultGrid.setCellValue(item, 'companyName', companyCodes[i]['textField'])
e.items[0].whName = ""; }
loadChange(grid,e,"projName"); }
loadChange(grid,e,"whCode"); resultGrid.setCellValue(item, 'projName', '')
loadChange(grid,e,"whName"); resultGrid.setCellValue(item, 'whCode', '')
loadChange(grid,e,"projCode"); resultGrid.setCellValue(item, 'whName', '')
resultGrid.setCellValue(item, 'projCode', '')
} }
if (e.field == "whCode") { if (e.field == "whCode") {
loadChange(grid,e,"whName"); for(let i=0;i<whRecordBoxBlocks.length;i++){
if(item.whCode === whRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'whName', whRecordBoxBlocks[i]['textField'])
}
}
} }
}); });
}, },
beforeEdit: function (e) {
let item = e.model;
if(item.status != '0'){
e.preventDefault();
}
},
afterEdit:function (e) { afterEdit:function (e) {
}, },
onSave: function (e) { onSave: function (e) {
......
...@@ -19,6 +19,13 @@ $(function (){ ...@@ -19,6 +19,13 @@ $(function (){
pageSize: 10, pageSize: 10,
pageSizes: [10, 20, 50, 100], pageSizes: [10, 20, 50, 100],
}, },
beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val();
//如果提交了,则不能修改
if(status && status === "1"){
e.preventDefault();
}
},
columns: [ columns: [
{ {
field: "inventCode", field: "inventCode",
...@@ -41,51 +48,7 @@ $(function (){ ...@@ -41,51 +48,7 @@ $(function (){
input.kendoDropDownList({ input.kendoDropDownList({
dataSource: inventRecordBoxBlocks, dataSource: inventRecordBoxBlocks,
minLength: 0, minLength: 0,
dataTextField: "textField", dataTextField: "valueField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},
{
field: "invSpec",
template: function (item) {
let template = "";
if(item.invSpec){
for(let i=0;i<specBoxBlocks.length;i++){
if(item.invSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
}
}
}
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
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", dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#", optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#", valueTemplate: "[#:valueField#]#:textField#",
...@@ -130,65 +93,25 @@ $(function (){ ...@@ -130,65 +93,25 @@ $(function (){
resultGrid.setCellValue(item, 'invWeight', totalWeight) resultGrid.setCellValue(item, 'invWeight', totalWeight)
} }
} }
if (e.field == "inventType") {
//选择后,先加载此方法,再加载属性中的方法,所以存货类型加载时,先修改存货编号下拉框的查询
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode",item.whCode);
inInfo.set("inqu_status-0-companyCode",item.companyCode);
inInfo.set("inqu_status-0-inventType",item.inventType);
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
inventRecordBoxBlocks = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
resultGrid.setCellValue(item, 'inventCode', "")
resultGrid.setCellValue(item, 'inventName', "")
resultGrid.setCellValue(item, 'invSpecId', "")
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") { if (e.field == "inventCode") {
for(let i=0;i<inventRecordBoxBlocks.length;i++){ for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){ if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField']) resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField'])
} resultGrid.setCellValue(item, 'inventType', specBoxBlocks[i]['param1Field'])
} resultGrid.setCellValue(item, 'invSpecId', specBoxBlocks[i]['param2Field'])
resultGrid.setCellValue(item, 'invSpecId', "") resultGrid.setCellValue(item, 'invSpec', specBoxBlocks[i]['param3Field'])
resultGrid.setCellValue(item, 'invSpec', "") resultGrid.setCellValue(item, 'invLength', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invLength', "") resultGrid.setCellValue(item, 'invWidth', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWidth', "") resultGrid.setCellValue(item, 'invThick', specBoxBlocks[i]['param6Field'])
resultGrid.setCellValue(item, 'invThick', "") resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param7Field'])
resultGrid.setCellValue(item, 'invQty', "") resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param8Field'])
resultGrid.setCellValue(item, 'invUnitWeight', "") resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param9Field'])
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'])
resultGrid.setCellValue(item, 'invSpecId', specBoxBlocks[i]['param7Field'])
} }
} }
resultGrid.setCellValue(item, 'price', "") resultGrid.setCellValue(item, 'price', "")
resultGrid.setCellValue(item, 'amount', "") resultGrid.setCellValue(item, 'amount', "")
loadChange(grid,e,"invQty"); loadChange(grid,e,"invQty");
} }
}); });
}, },
afterEdit:function (e) { afterEdit:function (e) {
......
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
<EF:EFColumn ename="receiveId" cname="领料单id" hidden="true"/> <EF:EFColumn ename="receiveId" cname="领料单id" hidden="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" hidden="true"/> <EF:EFColumn ename="whCode" cname="仓库编码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" hidden="true"/> <EF:EFColumn ename="companyCode" cname="公司编码" hidden="true"/>
<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:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_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="true" enable="false"
filter="contains"> filter="contains">
</EF:EFComboColumn> </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="invSpecId" cname="规格id" hidden="true"/> <EF:EFColumn ename="invSpecId" cname="规格id" hidden="true"/>
<EF:EFColumn ename="invSpec" cname="规格" width="120" align="center" required="true" /> <EF:EFColumn ename="invSpec" cname="规格" width="120" align="center" required="true" enable="false"/>
<EF:EFColumn ename="invLength" cname="长度(MM)" width="120" align="center" enable="false"/> <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="invWidth" cname="宽度(MM)" width="120" align="center" enable="false"/>
<EF:EFColumn ename="invThick" cname="厚度(MM)" width="120" align="center" enable="false"/> <EF:EFColumn ename="invThick" cname="厚度(MM)" width="120" align="center" enable="false"/>
......
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