From e3714e60bf07e682abb90cfc8f92803d875cdc45 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Wed, 13 Jul 2022 19:01:46 +0800 Subject: [PATCH] =?UTF-8?q?'=E9=94=80=E5=94=AE=E8=AE=A2=E8=88=B1=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=88=B9=E5=85=AC=E5=8F=B8=E8=88=AA=E7=BA=BF?= =?UTF-8?q?=E6=B8=AF=E5=8F=A3=E8=81=94=E5=8A=A8=EF=BC=9B=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=86=E7=A5=A8=EF=BC=8C=E5=88=86=E7=A5=A8=E9=9B=86=E8=A3=85?= =?UTF-8?q?=E7=AE=B1=E6=9C=AA=E5=8A=A0=E5=AE=8C'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DSWeb.Common/DB/Comm.cs | 33 + DSWeb.Common/DB/CommonDataContext.cs | 3 + .../Controllers/BasicDataRefController.cs | 18 +- DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs | 6 +- .../Controllers/MsSeaeOrderController.cs | 74 ++ .../DAL/MsSeaeOrder/MsSeaeOrderDAL.cs | 17 +- .../Viewsjs/MsSeaeOrder/MsSeaeOrderEdit.js | 785 ++++++++++++++++-- 7 files changed, 877 insertions(+), 59 deletions(-) diff --git a/DSWeb.Common/DB/Comm.cs b/DSWeb.Common/DB/Comm.cs index c0f61073..847ee32d 100644 --- a/DSWeb.Common/DB/Comm.cs +++ b/DSWeb.Common/DB/Comm.cs @@ -1333,5 +1333,38 @@ namespace DSWeb.Common.DB public string PORTNAME { get; set; } } + [Table("crm_seaeorder_fen")] + public partial class crm_seaeorder_fen_md + { + [Key] + public string BSNO { get; set; } + public string MASTERNO { get; set; } + public string ORDNO { get; set; } + public string CUSTOMERNAME { get; set; } + public string SHIPPERID { get; set; } + public string CONSIGNEEID { get; set; } + public string NOTIFYPARTYID { get; set; } + public int? PKGS { get; set; } + public decimal? KGS { get; set; } + public decimal? CBM { get; set; } + public string MARKS { get; set; } + public string DESCRIPTION { get; set; } + + public void SaveCopy(crm_seaeorder_fen_md newrec) + { + //MASTERNO = newrec.MASTERNO; + ORDNO = newrec.ORDNO; + CUSTOMERNAME = newrec.CUSTOMERNAME; + SHIPPERID = newrec.SHIPPERID; + CONSIGNEEID = newrec.CONSIGNEEID; + NOTIFYPARTYID = newrec.NOTIFYPARTYID; + PKGS = newrec.PKGS; + KGS = newrec.KGS; + CBM = newrec.CBM; + MARKS = newrec.MARKS; + DESCRIPTION = newrec.DESCRIPTION; + } + } + } \ No newline at end of file diff --git a/DSWeb.Common/DB/CommonDataContext.cs b/DSWeb.Common/DB/CommonDataContext.cs index 1c252908..06623463 100644 --- a/DSWeb.Common/DB/CommonDataContext.cs +++ b/DSWeb.Common/DB/CommonDataContext.cs @@ -61,6 +61,9 @@ namespace DSWeb.Common.DB public DbSet vw_code_lanes_port { get; set; } + public DbSet crm_seaeorder_fen { get; set; } + + } diff --git a/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs b/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs index e41e8763..93b2d6c2 100644 --- a/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs +++ b/DSWeb/Areas/CommMng/Controllers/BasicDataRefController.cs @@ -1211,15 +1211,21 @@ namespace DSWeb.Areas.CommMng.Controllers } } - public JsonResult GetCodeDisportListRm(string PORT) + public JsonResult GetCodeDisportListRm(string PORT="",string LANE="") { - if (PORT == "") + if (PORT == "" && LANE=="") { return Json(new { success = true, data = new CodeDisportModel() }); } - var evList = BasicDataRefDAL.GetCodeDisportList(" PORT LIKE '%" + PORT + "%' or CNAME like '%" + PORT + "%'"); + var condition = " (PORT LIKE '%" + PORT + "%' or CNAME like '%" + PORT + "%')"; + + if (!string.IsNullOrWhiteSpace(LANE)) { + condition += " and PORTID in(select PORTID from vw_code_lanes_port where LANE='"+ LANE + "')"; + } + + var evList = BasicDataRefDAL.GetCodeDisportList(condition); if (evList.Count == 0) { return Json(new { success = true, data = new CodeDisportModel() }); @@ -1229,6 +1235,8 @@ namespace DSWeb.Areas.CommMng.Controllers return Json(new { success = true, data = evList.ToList() }); } } + + #endregion #region 国内港口(出口装货港、进口卸货港) @@ -1353,9 +1361,9 @@ namespace DSWeb.Areas.CommMng.Controllers #endregion #region 航线 - public JsonResult GetCodeLaneList() + public JsonResult GetCodeLaneList(string CUSTOMERNAME="") { - var evList = BasicDataRefDAL.GetCodeLaneList(); + var evList = BasicDataRefDAL.GetCodeLaneList(CUSTOMERNAME); if (evList.Count == 0) { return Json(new { success = true, data = new LaneModel() }); diff --git a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs index 5b3d6958..9f9c62b8 100644 --- a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs @@ -3270,9 +3270,13 @@ namespace DSWeb.Areas.CommMng.DAL #endregion #region 航线 - static public List GetCodeLaneList() + static public List GetCodeLaneList(string CUSTOMERNAME="") { String strSql = "select * from [code_lanes] ORDER BY LANE"; + if (!string.IsNullOrWhiteSpace(CUSTOMERNAME)) + { + strSql= "select * from [code_lanes] where CUSTOMERNAME='"+ CUSTOMERNAME + "' ORDER BY LANE"; + } return SetCodeLaneData(strSql); } private static List SetCodeLaneData(String strSql) diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsSeaeOrderController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsSeaeOrderController.cs index 5ec809ef..3fc000ac 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsSeaeOrderController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsSeaeOrderController.cs @@ -28,6 +28,8 @@ using DSWeb.MvcShipping.DAL.MsOpSeaiDAL; using DSWeb.Areas.RptMng.Comm; using DSWeb.Areas.SysMng.DAL.SysUser; using DSWeb.Areas.Import.DAL.ReceiptDoc; +using DSWeb.Common.DB; +using DSWeb.Areas.MvcShipping.Helper; namespace DSWeb.MvcShipping.Controllers { @@ -135,6 +137,15 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = json }; } + public ContentResult GetFenList(string MASTERNO) + { + var dataList = MsSeaeOrderDAL.GetFenList(MASTERNO); + + var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); + return new ContentResult() { Content = json }; + } + + public ContentResult Save(string opstatus, string data, string data2, string data3, string body) { var headData = JsonConvert.Deserialize(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", "")); @@ -270,6 +281,69 @@ namespace DSWeb.MvcShipping.Controllers } } + public ContentResult SaveFen(string data, string data2, string data3, string fen) + { + var headData = JsonConvert.Deserialize(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", "")); + var FenList = JsonConvert.Deserialize>(fen); + var isPost = true; + var errorstr = ""; + + //if (headData.MBLNO != "" && headData.MBLNO != null) + //{ + // var ct = MsSeaeOrderDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and ORSTATUS<>'4'"); + // if (ct != 0) + // { + // isPost = false; + // errorstr = "主提单号重复"; + // } + //} + + try + { + + DBResult result = new DBResult(); + + var cdc = new CommonDataContext(); + + if (FenList.Count > 0) + { + + foreach (var item in FenList) + { + if (item.ORDNO=="*") + { + //item.BSNO = System.Guid.NewGuid().ToString(); + item.ORDNO = PubSysDAL.GetBillNo("0309"); + item.MASTERNO = headData.BSNO; + cdc.crm_seaeorder_fen.Add(item); + } + else + { + var updrec = cdc.crm_seaeorder_fen.FirstOrDefault(x => x.BSNO == item.BSNO); + + //updrec = AutoMapperHelper.MapTo(item); + updrec.SaveCopy(item); + } + } + cdc.SaveChanges(); + } + + var jsonRespose = new JsonResponse + { + Success = true, + Message = "保存成功", + Data = "" + }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + catch(Exception e) + { + var jsonRespose = new JsonResponse { Success = false, Message = e.Message + ",不允许保存!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + } + + public ContentResult DeleteDetail(string data) { var head = JsonConvert.Deserialize(data); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsSeaeOrder/MsSeaeOrderDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsSeaeOrder/MsSeaeOrderDAL.cs index 4b754ff2..507fc26a 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsSeaeOrder/MsSeaeOrderDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsSeaeOrder/MsSeaeOrderDAL.cs @@ -22,6 +22,8 @@ using DSWeb.MvcShipping.Models.MsOpMailLog; using DSWeb.Areas.SysMng.DAL.SysUser; using DSWeb.Areas.Import.DAL.ReceiptDoc; using MimeKit.Text; +using DSWeb.Common.DB; +using System.Linq; namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL { @@ -562,7 +564,20 @@ namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL reader.Close(); } return bodyList; - } + } + + static public List GetFenList(string MASTERNO) + { + + var cdc = new CommonDataContext(); + + var list = new List(); + + list = cdc.crm_seaeorder_fen.Where(x => x.MASTERNO == MASTERNO).OrderBy(o => o.ORDNO).ToList(); + + return list; + } + #endregion #region 保存明细 diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsSeaeOrder/MsSeaeOrderEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsSeaeOrder/MsSeaeOrderEdit.js index 68a431b0..198de799 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsSeaeOrder/MsSeaeOrderEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsSeaeOrder/MsSeaeOrderEdit.js @@ -30,20 +30,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.ISMUSTBECNTR = '0'; //#region 信息加载 - //航线 - this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { - model: 'DsShipping.ux.Lane', - proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } - }); - this.storeLANE.load(); - this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { - fieldLabel: '航线', - store: this.storeLANE, - // forceSelection: true, - name: 'LANE', - valueField: 'LANE', - displayField: 'LANE' - }); + this.storeDefValue = Ext.create('Ext.data.Store', { model: 'DsShipping.ux.OpDefValue', @@ -322,6 +309,23 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }); + this.comboxCustCode_Fen = Ext.create('DsExt.ux.RefTableCombox', { + store: this.storeCustCode, + queryMode: 'remote', + forceSelection: true, + minChars: 1, + queryParam: 'CODENAME', + name: 'CUSTOMERNAME', + valueField: 'CustName', + displayField: 'CodeAndName', + allowBlank: false, + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + + } + } + }); this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.InfoClientContactModel', @@ -356,6 +360,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船公司', store: this.storeCARRIER, + matchFieldWidth: false, queryMode: 'remote', forceSelection: true, minChars: 1, @@ -367,25 +372,69 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { - var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; - this.storeInfoClientContactCARRIER.load({ params: { condition: s }, - callback: function (r, options, success) { - if (success) { - if (this.storeInfoClientContactCARRIER.getCount() > 0) { - var member = this.storeInfoClientContactCARRIER.getAt(0); - this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME); - this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL); - this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL); - } else { - this.formHead.getForm().findField('CARRIERATTN').setValue(''); - this.formHead.getForm().findField('CARRIERTEL').setValue(''); - this.formHead.getForm().findField('CARRIEREMAIL').setValue(''); - } - } - }, - scope: this - }); + //var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; + //this.storeInfoClientContactCARRIER.load({ params: { condition: s }, + // callback: function (r, options, success) { + // if (success) { + // if (this.storeInfoClientContactCARRIER.getCount() > 0) { + // var member = this.storeInfoClientContactCARRIER.getAt(0); + // this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME); + // this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL); + // this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL); + // } else { + // this.formHead.getForm().findField('CARRIERATTN').setValue(''); + // this.formHead.getForm().findField('CARRIERTEL').setValue(''); + // this.formHead.getForm().findField('CARRIEREMAIL').setValue(''); + // } + // } + // }, + // scope: this + //}); + //载入航线 + this.LoadLane(combo.value); + } + } + } + }); + //航线 + this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.Lane', + proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } + }); + //this.storeLANE.load(); + this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '航线', + store: this.storeLANE, + // forceSelection: true, + name: 'LANE', + valueField: 'LANE', + displayField: 'LANE', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + //combo.value + //var s = " ISOPERATOR=1 and LINKID in (select gid from [info_client] where SHORTNAME='" + combo.value + "')"; + //this.storeInfoClientContactCARRIER.load({ params: { condition: s }, + // callback: function (r, options, success) { + // if (success) { + // if (this.storeInfoClientContactCARRIER.getCount() > 0) { + // var member = this.storeInfoClientContactCARRIER.getAt(0); + // this.formHead.getForm().findField('CARRIERATTN').setValue(member.data.SHOWNAME); + // this.formHead.getForm().findField('CARRIERTEL').setValue(member.data.TEL); + // this.formHead.getForm().findField('CARRIEREMAIL').setValue(member.data.EMAIL); + // } else { + // this.formHead.getForm().findField('CARRIERATTN').setValue(''); + // this.formHead.getForm().findField('CARRIERTEL').setValue(''); + // this.formHead.getForm().findField('CARRIEREMAIL').setValue(''); + // } + // } + // }, + // scope: this + //}); + //载入港口 + this.LoadPort(combo.value); } } } @@ -715,6 +764,20 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }); + this.comboxShipper_Fen = Ext.create('DsExt.ux.RefTableCombox', { + store: this.storeShipper, + forceSelection: true, + labelAlign: 'left', + name: 'SHIPPERID', + valueField: 'SHORTNAME', + displayField: 'CodeAndName', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + + } + } + }); //客户加载_收货人 @@ -750,6 +813,28 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }); + this.comboxConsignee_Fen = Ext.create('DsExt.ux.RefTableCombox', { + labelAlign: 'left', + store: this.storeConsignee, + forceSelection: true, + name: 'CONSIGNEEID', + valueField: 'SHORTNAME', + displayField: 'CodeAndName', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + var selectrecords = DsStoreQueryBy(this.storeConsignee, 'SHORTNAME', combo.value); + if (selectrecords.getCount() > 0) { + var selectdata = selectrecords.getAt(0).data; + this.formBill.getForm().findField('CONSIGNEE').setValue(selectdata.SHIPPERDETAIL); + } else { + this.formBill.getForm().findField('CONSIGNEE').setValue(''); + } + } + } + } + }); //客户加载_通知人 @@ -785,8 +870,28 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }); - - + this.comboxNotifyParty_Fen = Ext.create('DsExt.ux.RefTableCombox', { + store: this.storenotifyparty, + labelAlign: 'left', + forceSelection: true, + name: 'NOTIFYPARTYID', + valueField: 'SHORTNAME', + displayField: 'CodeAndName', + listeners: { + scope: this, + 'select': function (combo, records, eOpts) { + if (records.length > 0) { + var selectrecords = DsStoreQueryBy(this.storenotifyparty, 'SHORTNAME', combo.value); + if (selectrecords.getCount() > 0) { + var selectdata = selectrecords.getAt(0).data; + this.formBill.getForm().findField('NOTIFYPARTY').setValue(selectdata.SHIPPERDETAIL); + } else { + this.formBill.getForm().findField('NOTIFYPARTY').setValue(''); + } + } + } + } + }); this.myCheckboxService = new Ext.form.CheckboxGroup({ id: 'myService', @@ -1219,6 +1324,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { text: '集装箱信息', //'应收费用', style: 'font-size:14px', labelColor: '#000', + id:'ctntitle', //style:'background-color: #4b9bf5', x: '5%', @@ -1404,6 +1510,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '船 名', store: this.storeVoyVeg, + matchFieldWidth: false, name: 'VESSEL', valueField: 'VESSEL', flex: 1, @@ -1493,13 +1600,17 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { store: this.storeCodeDisport, name: 'PORTDISCHARGE', valueField: 'PORT', - queryMode: 'remote', + //queryMode: 'remote', + //queryParam: 'PORT', matchFieldWidth: false, - minChars: 1, - queryParam: 'PORT', + //minChars: 1, + displayField: 'CodeAndName', listeners: { scope: this, + beforequery: function (e) { + return FilterCombox(e); + }, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport, 'PORT', combo.value); @@ -1536,14 +1647,17 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { fieldLabel: '目的港', store: this.storeCodeDisport2, name: 'DESTINATION', - queryMode: 'remote', - minChars: 1, - matchFieldWidth: false, + //queryMode: 'remote', + //minChars: 1, + //matchFieldWidth: false, queryParam: 'PORT', valueField: 'PORT', displayField: 'CodeAndName', listeners: { scope: this, + beforequery: function (e) { + return FilterCombox(e); + }, 'select': function (combo, records, eOpts) { if (records.length > 0) { var selectrecords = DsStoreQueryBy(this.storeCodeDisport2, 'PORT', combo.value); @@ -1633,12 +1747,19 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.comboxTRANSPORT = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '中转港', store: this.storeCodeDisport5, + matchFieldWidth: false, name: 'TRANSPORT', valueField: 'PORT', - queryMode: 'remote', - minChars: 1, - queryParam: 'PORT', - displayField: 'PORT' + //queryMode: 'remote', + //minChars: 1, + //queryParam: 'PORT', + displayField: 'PORT', + listeners: { + scope: this, + beforequery: function (e) { + return FilterCombox(e); + }, + } }); this.comboxISSUEPLACE = Ext.create('DsExt.ux.RefTableCombox', { @@ -1691,7 +1812,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { fieldLabel: 'H签单方式', store: this.storeISSUETYPE2, forceSelection: true, - name: 'ISSUETYPE', + name: 'ISSUETYPE2', valueField: 'BLTYPE', displayField: 'BLTYPE' }); @@ -2129,7 +2250,8 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } ] - }, { + }, + { xtype: 'container', layout: 'anchor', flex: 1, @@ -2357,6 +2479,311 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { items: [this.formBill] }); + //#region 分票列表 + + this.storeFenList = Ext.create('Ext.data.Store', { + model: 'MsSeaeOrderModel', + remoteSort: false, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsSeaeOrder/GetFenList', + reader: { + id: 'ORDNO,CTN_ID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + this.FenListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + this.FenList = new Ext.grid.GridPanel({ + store: this.storeFenList, + height: 260, + enableHdMenu: false, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + singleSelect: true, + plugins: [this.FenListCellEditing], + selType: 'cellmodel', + + tbar: [ + + { + text: '增加明细', + tooltip: '增加明细', + id: "btnaddfen", + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddFenClick(button, event); + }, + scope: this + }, { + text: '删除明细', + tooltip: '删除明细', + id: "btndelfen", + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDelFenClick(button, event); + }, + scope: this + }, '-',{ + id: 'btnFenSave', + text: "保存分票信息", + iconCls: "btnsave", + handler: function (button, event) { + this.SaveFen(); + }, + scope: this + }, { + xtype: 'label', + text: '注意,选中左边分票信息时,右边集装箱信息会相应切换为该分票当前集装箱信息。请及时保存集装箱信息。', //'应收费用', + style: 'font-size:12px', + labelColor: '#000', + id: 'fennotice', + + //style:'background-color: #4b9bf5', + x: '30%', + y: '5%' + } + ], + + columns: [{ + sortable: true, + dataIndex: 'CTN_ID', + header: '编号', + hidden: true, + width: 0 + }, { + sortable: true, + dataIndex: 'ORDNO', + header: '业务编号', + width: 0 + + }, { + dataIndex: 'CUSTOMERNAME', //CTNEXHIBIT + header: '委托单位', + width: 120, + editor: this.comboxCustCode_Fen + }, { + dataIndex: 'SHIPPERID', + header: '发货人', + width: 120, + editor: this.comboxShipper_Fen + }, { + dataIndex: 'CONSIGNEEID', + header: '收货人', + width: 120, + editor: this.comboxConsignee_Fen + }, { + dataIndex: 'NOTIFYPARTYID', + header: '通知人', + width: 50, + editor: this.comboxNotifyParty_Fen + }, { + dataIndex: 'PKGS', + header: '件数', + width: 90, + editor: { + xtype: 'numberfield', + allowBlank: false, + selectOnFocus: true + } + }, { + dataIndex: 'KGS', + header: '毛重', + width: 90, + editor: { + xtype: 'numberfield', + allowBlank: false, + selectOnFocus: true + } + }, { + dataIndex: 'CBM', + header: '尺码', + width: 90, + editor: { + xtype: 'numberfield', + allowBlank: false, + selectOnFocus: true + } + }, { + dataIndex: 'MARKS', + header: 'MARKS', + width: 150, + + editor: { + height: 120, + xtype: 'textareafield', + selectOnFocus: true + } + }, { + dataIndex: 'DESCRIPTION', + header: '货描', + width: 150, + editor: { + height: 120, + xtype: 'textareafield', + selectOnFocus: true + } + } + ] + }); + + this.FenList.getSelectionModel().on('select', function (button, event) { + this.onSelectFen(button, event); + }, this); + + + this.storeFenCtnList = Ext.create('Ext.data.Store', { + model: 'MsSeaeOrderCtn', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsSeaeOrder/GetBodyList', + reader: { + id: 'ORDNO,CTN_ID', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + this.FenCtnListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + this.FenCtnList = new Ext.grid.GridPanel({ + store: this.storeFenCtnList, + enableHdMenu: false, + height: 260, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + plugins: [this.FenCtnListCellEditing], + selType: 'cellmodel', + + tbar: [ + + { + xtype: 'label', + text: '集装箱信息', //'应收费用', + style: 'font-size:14px', + labelColor: '#000', + + //style:'background-color: #4b9bf5', + x: '5%', + y: '5%' + }, + { + text: '增加明细', + tooltip: '增加明细', + id: "btnadddetail2", + iconCls: "btnadddetail", + handler: function (button, event) { + this.onAddDetailClick_Fen(button, event); + }, + scope: this + }, '-', { + text: '删除明细', + tooltip: '删除明细', + id: "btndeldetail2", + iconCls: "btndeletedetail", + handler: function (button, event) { + this.onDelDetailClick_Fen(button, event); + }, + scope: this + }], + + columns: [{ + sortable: true, + dataIndex: 'CTN_ID', + header: '编号', + hidden: true, + width: 0 + }, { + sortable: true, + dataIndex: 'ORDNO', + header: '业务编号', + hidden: true, + width: 0 + }, { + dataIndex: 'CTNALL', //CTNEXHIBIT + header: '箱型', + width: 90, + editor: this.comboxCTNALL + }, { + dataIndex: 'CTNNUM', + header: '箱量', + width: 70, + editor: { + xtype: 'numberfield', + allowBlank: false, + selectOnFocus: true + } + }, { + dataIndex: 'REMARK', + header: '备注', + width: 190, + editor: { + xtype: 'textfield', + selectOnFocus: true + } + }] + }); + + + + + this.formFen = Ext.widget('form', { + region: 'north', + + frame: true, + bodyPadding: 5, + layout: 'anchor', + trackResetOnLoad: true, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 70, + msgTarget: 'qtip' + }, + + items: [{ + xtype: 'container', + defaultType: 'textfield', + layout: 'hbox', + height: 280, + defaults: { + anchor: '96%' + }, + items: [ + this.FenList, + this.FenCtnList + ] + + }] + }); + //#endregion + + this.panelFenPiao = new Ext.Panel({ + title: '分票信息', //'舱单信息', + layout: "border", + region: 'center', + animate: true, + autoScroll: true, + containerScroll: true, + frame: false, + items: [ + this.formFen + ] + }); //#region 审核或驳回界面 this.storeUser = Ext.create('DsExt.ux.RefTableStore', { @@ -2391,6 +2818,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.comboxFORWARDER2 = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '订舱代理', store: this.storeFORWARDER2, + matchFieldWidth: false, forceSelection: true, name: 'FORWARDER', valueField: 'CustName', @@ -2933,7 +3361,8 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { items: [ this.panelSeae, - this.panelBill + this.panelBill, + this.panelFenPiao ] }); @@ -3066,7 +3495,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { else { document.title = "销售订舱-新增"; } - + this.LoadData(this.opStatus, condition); this.LoadMustBe(); }, //end InitData @@ -3155,7 +3584,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.panelFee.storeCrChFee.load({ params: { billno: data.BSNO, type: 2, optype: "op_Seae"} }); this.panelFee.storeBodySum.load({ params: { bsno: data.BSNO} }); - + this.LoadFen(data.BSNO); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } @@ -3298,6 +3727,76 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }); }, //end save + + + SaveFen: function () { + if (this.formHead.getForm().findField('ORDNO').getValue() == "") { + Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再录入分票信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + return; + } else { + + + //var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel); + this.formHead.getForm().findField('ORDNO').setDisabled(false); + var data = this.formHead.getForm().getValues(false, false, false); + var data2 = this.formEdit.getForm().getValues(false, false, false); + var data3 = this.formBill.getForm().getValues(false, false, false); + this.formHead.getForm().findField('ORDNO').setDisabled(true); + + + var bodydatas = []; + + for (var i = 0; i < this.storeFenList.getCount(); i += 1) { + var member = this.storeFenList.getAt(i); + + bodydatas.push(member); + } + var jsonFen = ConvertRecordsToJson(bodydatas); + + var fenctndatas = []; + for (var i = 0; i < this.storeFenCtnList.getCount(); i += 1) { + var member = this.storeFenCtnList.getAt(i); + + fenctndatas.push(member); + } + var jsonFenctn = ConvertRecordsToJson(fenctndatas); + + + Ext.Msg.wait('正在保存数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在保存数据...', + url: '/MvcShipping/MsSeaeOrder/SaveFen', + scope: this, + params: { + data: Ext.JSON.encode(data), + data2: Ext.JSON.encode(data2), + data3: Ext.JSON.encode(data3), + fen: jsonFen, + fenctn: jsonFenctn + + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + + + this.LoadFen(); + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ + title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + } + }, //#endregion //#region 集装箱按钮事件 @@ -3325,8 +3824,6 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); }, - - deleteDetail: function () { var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { @@ -3375,6 +3872,149 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { } }, + + onAddFenClick: function () { + + if (this.formHead.getForm().findField('ORDNO').getValue() == "") { + Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再录入分票信息!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + return; + } + + let dirtycount = 0; + for (var i = 0; i < this.storeFenList.getCount(); i += 1) { + var member = this.storeFenList.getAt(i); + + if (member.dirty) { + dirtycount++; + } + } + if (dirtycount > 1) { + Ext.MessageBox.alert('请先保存未保存的分票信息', response.responseText); + return; + } + else + { + + var record = Ext.create('MsSeaeOrderModel', { + BSNO: NewGuid(), + ORDNO: '*' + }); + this.storeFenList.add(record); + var n = this.storeFenList.getCount(); + this.FenListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); + } + }, + onDelFenClick: function () { + var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); + if (ORSTATUS == '0') { + Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); + var selectedRecords = this.FenList.selModel.getSelection(); + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 + { + this.storeFenList.remove(selectedRecords[i]); + } + else { + Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在删除数据...'); + Ext.Ajax.request({ + waitMsg: '正在删除数据...', + url: '/MvcShipping/MsSeaeOrder/DeleteFen', + params: { + data: Ext.JSON.encode(rec.data) + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.storeFenList.remove(rec); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + } + //this.storeBodyList.remove(selectedRecords[i]); + } + }, + + + onAddDetailClick_Fen: function () { + + var record = Ext.create('MsSeaeOrderCtn', { + CTN_ID: NewGuid(), + ORDNO: '*', + CTNALL: '', + CTNNUM: 0, + REMARK: '' + }); + this.storeFenCtnList.add(record); + var n = this.storeFenCtnList.getCount(); + this.FenCtnListCellEditing.startEditByPosition({ row: n - 1, column: 2 }); + }, + + onDelDetailClick_Fen: function () { + var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); + if (ORSTATUS == '0') { + Ext.Msg.show({ title: '警告', msg: '业务已提交审核,不允许操作!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + return; + } + //this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo); + var selectedRecords = this.FenCtnList.selModel.getSelection(); + for (var i = 0; i < selectedRecords.length; i++) { + var rec = selectedRecords[i]; + if (rec.data.ORDNO == "" || rec.data.ORDNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台 + { + this.storeFenCtnList.remove(selectedRecords[i]); + } + else { + Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在删除数据...'); + Ext.Ajax.request({ + waitMsg: '正在删除数据...', + url: '/MvcShipping/MsSeaeOrder/DeleteDetail', + params: { + data: Ext.JSON.encode(rec.data) + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + this.storeFenCtnList.remove(rec); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + } + //this.storeBodyList.remove(selectedRecords[i]); + } + }, + GetContractFee:function(){ var ORSTATUS = this.formHead.getForm().findField('ORSTATUS').getValue(); if (ORSTATUS == '0') { @@ -3483,7 +4123,7 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { // this.panelORREASON.hide(); // } - var CARGOID = this.formHead.getForm().findField('CARGOID').getValue(); + var CARGOID = this.formEdit.getForm().findField('CARGOID').getValue(); if (CARGOID == 'R') { this.panelBodyDr.setVisible(false); @@ -3529,6 +4169,9 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { this.storeFORWARDER.add(recordCustCode); } + this.LoadLane(data.CARRIER); + + this.LoadPort(data.LANE); }, //#endregion @@ -4543,7 +5186,45 @@ Ext.extend(Shipping.MsSeaeOrderEdit, Ext.Panel, { PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); + }, + //#endregion + + //#region 载入航线和港口 + LoadLane: function (CUSTOMERNAME) { + this.storeLANE.load({ params: { CUSTOMERNAME: CUSTOMERNAME } }); + }, + LoadPort: function (LANE) { + + this.storeCodeDisport.load({ params: { PORT: "", LANE: LANE } }); + this.storeCodeDisport2.load({ params: { PORT: "", LANE: LANE } }); + this.storeCodeDisport5.load({ params: { PORT: "", LANE: LANE } }); } + + + //#endregion + + //#region 载入分票信息和分票箱信息 + , + onSelectFen: function (button, event) { + + var selectedRecords = this.FenList.selModel.getSelection(); + var record = selectedRecords[0]; + + + + }, + LoadFen() { + //载入 + let BSNO = this.editRecord.get('BSNO').toString(); + + this.storeFenList.load({ params: { MASTERNO: BSNO } }); + }, + LoadFenCtn(FenORDERNO) { + //载入 + + this.storeFenCtnList({ params: { condition: " ORDERNO='" + FenORDERNO +"' " } }); + } + //#endregion });