From 58ec0e9a90fdc2170805f8a93ccd69863da39190 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Mon, 14 Nov 2022 19:29:29 +0800 Subject: [PATCH] =?UTF-8?q?'=E8=88=B1=E5=8D=95=E4=B8=9A=E5=8A=A1=E5=AE=8C?= =?UTF-8?q?=E6=88=9020221114'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MsOpOtherController.cs | 47 +---- .../Controllers/MsOpSeaeEdiController.cs | 39 ++++ .../MsOpOther/MsOpOther_CangDanEdit.js | 87 ++++---- .../MsOpOther/MsOpOther_CangDanIndex.js | 3 +- .../MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js | 193 ++++++++++++------ 5 files changed, 206 insertions(+), 163 deletions(-) diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpOtherController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpOtherController.cs index 803cf3cd..eff63803 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpOtherController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpOtherController.cs @@ -496,7 +496,8 @@ namespace DSWeb.MvcShipping.Controllers headData.DbOperationType = DbOperationType.DbotIns; // headData.OPLB="op_other";//业务类型 - headData.OPLBNAME = "散杂运输";//业务类型名称 + if(string.IsNullOrWhiteSpace(headData.OPLBNAME)) + headData.OPLBNAME = "散杂运输";//业务类型名称 headData.BSSTATUS = false;//业务状态 headData.FEESTATUS = false;//费用状态 headData.ISVOU = false;//是否生成凭证 @@ -581,50 +582,6 @@ namespace DSWeb.MvcShipping.Controllers } } - public ContentResult Save_CangDan(string opstatus, string data, string data2, string data3,string body) - { - var r1 = Save_Base(opstatus, data, data2); - - if (r1.Success) { - - var _head = (MsOpOtherEntity)r1.Data; - - //如果保存成功 则根据 data3更新op_seae_edi表 根据body更新crm_seaeorderctn - var cdc = new DSWeb.Common.DB.CommonDataContext(); - if (opstatus == "add") { - //新增业务和明细 - var newedihead = JsonConvert.Deserialize(data3); - newedihead.BSNO= _head.BSNO; - newedihead.MFNO = _head.BSNO; - newedihead.MASTERNO = _head.BSNO; - newedihead.CUSTNO= _head.CUSTNO; - cdc.op_seae_edi.Add(newedihead); - } - if (opstatus == "edit") { - var edihead = JsonConvert.Deserialize(data3); - edihead.BSNO = _head.BSNO; - edihead.MFNO = _head.BSNO; - edihead.MASTERNO = _head.BSNO; - edihead.CUSTNO = _head.CUSTNO; - cdc.op_seae_edi.AddOrUpdate(edihead); - } - - var bodylist = JsonConvert.Deserialize>(body); - if (bodylist != null) - foreach (var item in bodylist) { - item.MFNO = _head.BSNO; - if (string.IsNullOrWhiteSpace(item.ctn_id)) { - item.ctn_id = Guid.NewGuid().ToString(); - } - cdc.op_seae_edi_ctn.AddOrUpdate(item); - } - cdc.SaveChanges(); - } - - return new ContentResult() { Content = JsonConvert.Serialize(r1) }; - } - - public ContentResult PiliangServiceFee(string bill, string fee) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs index bb08cc25..6a6b6d76 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs @@ -22,6 +22,8 @@ using DSWeb.MvcShipping.DAL.MsSysParamSet; using DSWeb.SoftMng.DAL.SoftSysTable; using DSWeb.Areas.Account.DAL.Chfee_Settlement; using DSWeb.MvcShipping.DAL.MsChFeeDAL; +using DSWeb.Common.DB; +using DSWeb.Areas.MvcShipping.Helper; namespace DSWeb.MvcShipping.Controllers { @@ -82,6 +84,43 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = json }; } + /// + /// 通过OP_Other的编辑页菜单打开 + /// 如有业务则按原逻辑返回 如无则新建记录 并将提单号 分单号 etd抄写后返回 + /// + /// + /// + /// + public ContentResult GetData_OpOther(string MASTERNO) + { + MsOpSeaeEdi head = null; + + head = MsOpSeaeEdiDAL.GetData("B.MASTERNO='"+ MASTERNO + "'"); + + if (head == null || head.BSNO=="") + { + head = new MsOpSeaeEdi(); + head.INPUTBY = Convert.ToString(Session["SHOWNAME"]); + + var cdc = new CommonDataContext(); + + var opotherlist = cdc.op_other.Where(x => x.BSNO == MASTERNO).ToList(); + + if (opotherlist != null && opotherlist.Count > 0) { + var opother = opotherlist[0]; + + head = AutoMapperHelper.MapTo(opother); + head.MASTERNO = MASTERNO; + head.BSNO = ""; + head.MFNO = ""; + } + } + + var json = JsonConvert.Serialize( + new { Success = true, Message = "查询成功", data = head }); + return new ContentResult() { Content = json }; + } + public ContentResult GetBodyList(string condition) { var dataList = MsOpSeaeEdiDAL.GetBodyList(condition); diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanEdit.js index 3fb87e14..8fe35a9b 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanEdit.js @@ -446,6 +446,9 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true + }, { + fieldLabel: 'OPLBNAME', + name: 'OPLBNAME', hidden: true }, { fieldLabel: '业务状态', readOnly: true, @@ -981,17 +984,34 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { closable: true, title: record.data.DESCRIPTION }); - } else { - var paneltabitems = new Ext.Panel({ - id: 'pnl' + record.data.NAME, - layout: "fit", - region: "center", - autoScroll: true, - frame: false, - closable: true, - title: record.data.DESCRIPTION, - html: ' ' - }); + } else { + + if (record.data.NAME == 'modOpSeaeEdiEdit') { + var _url = record.data.MODULEURL + "?MASTERNO=" + this.editRecord.get('BSNO'); + var paneltabitems = new Ext.Panel({ + id: 'pnl' + record.data.NAME, + layout: "fit", + region: "center", + autoScroll: true, + frame: false, + closable: true, + title: record.data.DESCRIPTION, + html: ' ' + }); + + } else { + + var paneltabitems = new Ext.Panel({ + id: 'pnl' + record.data.NAME, + layout: "fit", + region: "center", + autoScroll: true, + frame: false, + closable: true, + title: record.data.DESCRIPTION, + html: ' ' + }); + } } this.tabOtherPanel.add(paneltabitems); this.tabOtherPanel.setActiveTab(paneltabitems); @@ -1401,6 +1421,7 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { return; } data = result.data; + data.OPLBNAME = "舱单申报"; this.formHead.getForm().reset(); this.formHead.getForm().setValues(data); this.formEdit.getForm().reset(); @@ -1463,34 +1484,6 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { }); this.panelFee.storeChFeeGain.load({ params: { bsno: data.BSNO, optype: "op_other" } }); - - var edi_condition = "MFNO='" + data.BSNO +"'"; - Ext.Ajax.request({ - waitMsg: '正在查询主表数据...', - url: '/MvcShipping/MsOpSeaeEdi/GetData', - params: { - handle: opstatus, - condition: condition - }, - callback: function (options, success, response) { - if (success) { - var result = Ext.JSON.decode(response.responseText); - if (!result.Success) { - Ext.Msg.show({ - title: '提示', - msg: result.Message, - icon: Ext.MessageBox.ERROR, - buttons: Ext.Msg.OK - }); - return; - } - data = result.data; - _this.formBill.getForm().reset(); - _this.formBill.getForm().setValues(data); - } - } - }); - } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } @@ -1802,11 +1795,6 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { if (!basicForm.isValid()) { return; } - - var basicForm3 = this.formBill.getForm(); - if (!basicForm3.isValid()) { - return; - } if (this.accdatesameetd == 1) { @@ -1843,8 +1831,6 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { this.formHead.getForm().findField('BSNO').setDisabled(true); var data2 = this.formEdit.getForm().getValues(false, false, false); - var data3 = this.formBill.getForm().getValues(false, false, false); - var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); @@ -1858,14 +1844,12 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', - url: '/MvcShipping/MsOpOther/Save_CangDan', + url: '/MvcShipping/MsOpOther/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), - data2: Ext.JSON.encode(data2), - data3: Ext.JSON.encode(data3), - body: jsonBody + data2: Ext.JSON.encode(data2) }, callback: function (options, success, response) { if (success) { @@ -2089,7 +2073,8 @@ Ext.extend(Shipping.MsOpOtherEdit, Ext.Panel, { }); this.GetEditStatus(); - + this.formHead.getForm().findField("OPLBNAME").setValue("舱单申报"); + }, LoadMustBe: function () { diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanIndex.js index 84a79970..827cf53c 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpOther/MsOpOther_CangDanIndex.js @@ -1770,7 +1770,8 @@ Ext.extend(Shipping.MsOpOtherIndex, Ext.Panel, { return ''; } - var sql = ''; + //var sql = ''; + var sql = "OPLBNAME='舱单申报'"; var MBLNO = form.findField('MBLNO').getValue(); sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'"); diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js index 4c3f274f..9ff9c511 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeaeEdi/MsOpSeaeCustomEdiEdit.js @@ -26,6 +26,8 @@ Ext.extend(Shipping.MsOpSeaeCustomEdiEdit, Ext.Panel, { //this.bodyDel = []; this.itemindex = 1; + this.MASTERNO = getUrlParam('MASTERNO'); + //#region 数据集 this.StoreCargoid = Ext.create('Ext.data.Store', { @@ -1375,47 +1377,95 @@ Ext.extend(Shipping.MsOpSeaeCustomEdiEdit, Ext.Panel, { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; + _this = this; + if (this.MASTERNO) { - Ext.Ajax.request({ - waitMsg: '正在查询主表数据...', - url: '/MvcShipping/MsOpSeaeEdi/GetData', - params: { - handle: opstatus, - condition: condition - }, - callback: function (options, success, response) { - if (success) { - var result = Ext.JSON.decode(response.responseText); - if (!result.Success) { - Ext.Msg.show({ - title: '提示', - msg: result.Message, - icon: Ext.MessageBox.ERROR, - buttons: Ext.Msg.OK - }); - return; - } + Ext.Ajax.request({ + waitMsg: '正在查询主表数据...', + url: '/MvcShipping/MsOpSeaeEdi/GetData_OpOther', + params: { + MASTERNO: _this.MASTERNO + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } - data = result.data; + data = result.data; - this.formHead.getForm().reset(); - this.formHead.getForm().setValues(data); - this.formEdit.getForm().reset(); - this.formEdit.getForm().setValues(data); + if (data.BSNO == "") { + _this.opStatus = "add"; + data.BSNO == _this.MASTERNO; + data.MFNO == _this.MASTERNO; + } - this.LoadInit(); - this.GetEditStatus(); - } else { - Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); - } - }, - scope: this - }); - if (this.opStatus == 'edit') { - this.storeBodyList.load({ params: { condition: condition} }); + this.formHead.getForm().reset(); + this.formHead.getForm().setValues(data); + this.formEdit.getForm().reset(); + this.formEdit.getForm().setValues(data); + + this.LoadInit(); + this.GetEditStatus(); + } else { + Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); + } + }, + scope: this + }); + + this.storeBodyList.load({ params: { condition: "MFNO='" + this.MASTERNO + "'" } }); } else { - condition = "MFNO='XX'"; - this.storeBodyList.load({ params: { condition: condition} }); + + Ext.Ajax.request({ + waitMsg: '正在查询主表数据...', + url: '/MvcShipping/MsOpSeaeEdi/GetData', + params: { + handle: opstatus, + condition: condition + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (!result.Success) { + Ext.Msg.show({ + title: '提示', + msg: result.Message, + icon: Ext.MessageBox.ERROR, + buttons: Ext.Msg.OK + }); + return; + } + + data = result.data; + + this.formHead.getForm().reset(); + this.formHead.getForm().setValues(data); + this.formEdit.getForm().reset(); + this.formEdit.getForm().setValues(data); + + this.LoadInit(); + this.GetEditStatus(); + } else { + Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); + } + }, + scope: this + }); + + if (this.opStatus == 'edit') { + this.storeBodyList.load({ params: { condition: condition } }); + } else { + condition = "MFNO='XX'"; + this.storeBodyList.load({ params: { condition: condition } }); + } } }, // end LoadDate //#endregion @@ -1448,6 +1498,12 @@ Ext.extend(Shipping.MsOpSeaeCustomEdiEdit, Ext.Panel, { var data = this.formHead.getForm().getValues(false, false, false); var data2 = this.formEdit.getForm().getValues(false, false, false); this.formHead.getForm().findField('MFNO').setDisabled(true); + + if (this.MASTERNO) { + data.BSNO = this.MASTERNO; + data.MFNO = this.MASTERNO; + } + // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ @@ -1471,36 +1527,41 @@ Ext.extend(Shipping.MsOpSeaeCustomEdiEdit, Ext.Panel, { this.formEdit.getForm().setValues(returnData); this.formHead.getForm().reset(); this.formHead.getForm().setValues(returnData); - // - if (this.opStatus == 'add') { - var arrNewRecords = this.StoreList.add(returnData); - this.editRecord = arrNewRecords[0]; - } - else if (this.opStatus == 'edit') { - var editp = Ext.create('MsSeaeEdiModel', returnData); - this.editRecord.fields.each(function (field) { - if (field.persist) { - name = field.name; - if (name != 'id') - this.editRecord.set(name, editp.get(name)); - } - }, this); - this.editRecord.commit(); - } - if (type == '0') { - this.opStatus = 'edit'; - basicForm2.findField('MFNO').setDisabled(true); - for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { - var memberbody = this.storeBodyList.getAt(j); - memberbody.set("MFNO", this.editRecord.get('MFNO')); - memberbody.commit(); - }; - - - } else if (type == '1') { - window.close(); - } else if (type == '2') { - this.LoadData('add', ''); + + if (this.MASTERNO) { + this.LoadData(this.opStatus, ""); + } else { + + if (this.opStatus == 'add') { + var arrNewRecords = this.StoreList.add(returnData); + this.editRecord = arrNewRecords[0]; + } + else if (this.opStatus == 'edit') { + var editp = Ext.create('MsSeaeEdiModel', returnData); + this.editRecord.fields.each(function (field) { + if (field.persist) { + name = field.name; + if (name != 'id') + this.editRecord.set(name, editp.get(name)); + } + }, this); + this.editRecord.commit(); + } + if (type == '0') { + this.opStatus = 'edit'; + basicForm2.findField('MFNO').setDisabled(true); + for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { + var memberbody = this.storeBodyList.getAt(j); + memberbody.set("MFNO", this.editRecord.get('MFNO')); + memberbody.commit(); + }; + + + } else if (type == '1') { + window.close(); + } else if (type == '2') { + this.LoadData('add', ''); + } } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });