From 7ad75aa4371dfcbb8378ed969a4f4d79f1018ab9 Mon Sep 17 00:00:00 2001 From: ddlucky Date: Tue, 7 Mar 2023 10:46:59 +0800 Subject: [PATCH] =?UTF-8?q?20230307=E6=94=BE=E5=8D=95=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90=E3=80=82=E6=9A=82=E6=97=A0?= =?UTF-8?q?=E6=9C=AA=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MsOp_BLISSUEController.cs | 5 + .../DAL/MsOp_BLISSUE/MsOp_BLISSUEDAL.cs | 168 ++++++++++++------ .../Viewsjs/MsOpSeae/MsOpSeaeIndex.js | 12 +- 3 files changed, 122 insertions(+), 63 deletions(-) diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOp_BLISSUEController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOp_BLISSUEController.cs index 2e92a56a..e8e29cb4 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOp_BLISSUEController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOp_BLISSUEController.cs @@ -1251,6 +1251,11 @@ namespace DSWeb.MvcShipping.Controllers return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose0) }; } + //20230303 如果是财务扣单的话 也不允许添加 + var cwkd = MsOp_BLISSUEDAL.ISKDWithCW(dataList); + if (cwkd.Success) { + return BasicDataRefDAL.GetContentResult(cwkd); + } var DoDataList = new List(); var DoDataListDel = new List(); diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOp_BLISSUE/MsOp_BLISSUEDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOp_BLISSUE/MsOp_BLISSUEDAL.cs index a2efccdc..e4f01fad 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOp_BLISSUE/MsOp_BLISSUEDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOp_BLISSUE/MsOp_BLISSUEDAL.cs @@ -3628,29 +3628,21 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOp_BLISSUE var _recount = 0; var headList = GetDataList(" B.BSNO in (" + BSNO + ") ",0,999,out _recount); - //0 如果所有BSNO对应的特殊放单申请都已被审核通过 则直接返回true - var cdc = new CommonDataContext(); - var bsnoList = BSNO.Replace("'", "").Split(',').ToList(); - var 特放明细List = cdc.v_op_blissuelist_Detail.Where(x => bsnoList.Contains(x.bsno)); - var 特放审核通过 = true; - foreach (var bsno in bsnoList) { - var 审批通过的特放明细 = 特放明细List.Where(x => x.bsno == bsno && x.BLSTATUS == "审核通过").ToList(); - var 未审批通过的特放明细 = 特放明细List.Where(x => x.bsno == bsno && x.BLSTATUS != "审核通过").ToList(); - - - if (审批通过的特放明细 != null && 审批通过的特放明细.Count > 0 && (未审批通过的特放明细 == null || 未审批通过的特放明细.Count == 0)) - { + if (headList.Count == 0) { + result.SetErrorInfo("没有可以放单或放货的业务"); + return result; + } - } - else { - 特放审核通过 = false; - break; - } + //0 如果所有BSNO对应的特殊放单申请都已被审核通过 则直接返回true + result = 是否全部特放审核通过(BSNO); + if (result.Success) return result; + + //如果有财务扣单的 直接报错返回 + result = ISKDWithCW(BSNO); + if (result.Success) { + result.Success = false; + return result; } - if (特放审核通过) { - result.OK(); - return result; - } //1 如果是“最后一单” 即:除了这票业务之外,其他业务都已“提单签出” //则 只要客户有欠费 即不允许提单签出 @@ -3737,41 +3729,48 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOp_BLISSUE var result = new DBResult(); result.OK(); - //判断标准 该客户的全部其他业务 是否存在 BLISSUESTATUS<>'提单签出'且<>'已放货' 且其下属明细中有箱号长度11位的箱号 的 - var recordcount = 0; - var bsnostr ="'"+ string.Join("','", headList.Select(s => s.BSNO))+ "'"; - var 其他未签出业务List = GetDataList($" b.CUSTOMERNAME='{headList[0].CUSTOMERNAME}' and b.BLISSUESTATUS<>'提单签出' and b.BLISSUESTATUS<>'已放货' and exists(select 1 from op_ctn where BSNO=b.BSNO and len(CNTRNO)=11) and b.BSNO not in({bsnostr})", 0, 9, out recordcount); - - if (recordcount > 0) + try { - //result.OK("", false); - //判断这个或者这些业务当中 是否有其下属明细中有箱号长度11位的箱号 的 且 ETD=【该客户所有业务中(其下属明细中有箱号长度11位的箱号)的ETD最晚的】 - //如果有 也认为符合该条件的业务为【最后一票业务】 - var 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务 = GetDataList($" b.CUSTOMERNAME='{headList[0].CUSTOMERNAME}' and b.BLISSUESTATUS<>'提单签出' and b.BLISSUESTATUS<>'已放货' and exists(select 1 from op_ctn where BSNO=b.BSNO and len(CNTRNO)=11) ", 0, 9, out recordcount); - 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务 = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务.OrderByDescending(o => o.ETD).ToList(); - //var LastEtd = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务.Max(s=> Convert.ToDateTime(s.ETD)); - var LastEtd = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务[0].ETD; - - if (headList.Exists(e => e.ETD == LastEtd)) + + //判断标准 该客户的全部其他业务 是否存在 BLISSUESTATUS<>'提单签出'且<>'已放货' 且其下属明细中有箱号长度11位的箱号 的 + var recordcount = 0; + var bsnostr = "'" + string.Join("','", headList.Select(s => s.BSNO)) + "'"; + var 其他未签出业务List = GetDataList($" b.CUSTOMERNAME='{headList[0].CUSTOMERNAME}' and b.BLISSUESTATUS<>'提单签出' and b.BLISSUESTATUS<>'已放货' and exists(select 1 from op_ctn where BSNO=b.BSNO and len(CNTRNO)=11) and b.BSNO not in({bsnostr})", 0, 9, out recordcount); + + if (recordcount > 0) { - var 最晚业务 = headList.Where(x => x.ETD == LastEtd).ToList(); - //有其他未签出的 且用于判断的这些业务是ETD最晚的 是最后一票 - var custnoStr = "单号[" + string.Join(",", 最晚业务.Select(s=>s.CUSTNO).Distinct().ToArray()) + "]ATD:"+ LastEtd+",此后无单"; + //result.OK("", false); + //判断这个或者这些业务当中 是否有其下属明细中有箱号长度11位的箱号 的 且 ETD=【该客户所有业务中(其下属明细中有箱号长度11位的箱号)的ETD最晚的】 + //如果有 也认为符合该条件的业务为【最后一票业务】 + var 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务 = GetDataList($" b.CUSTOMERNAME='{headList[0].CUSTOMERNAME}' and b.BLISSUESTATUS<>'提单签出' and b.BLISSUESTATUS<>'已放货' and exists(select 1 from op_ctn where BSNO=b.BSNO and len(CNTRNO)=11) ", 0, 9, out recordcount); + 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务 = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务.OrderByDescending(o => o.ETD).ToList(); + //var LastEtd = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务.Max(s=> Convert.ToDateTime(s.ETD)); + var LastEtd = 该客户所有业务中未放货未提单签出且具备箱号长度11位的箱号当中ETD最大的业务[0].ETD; + + if (headList.Exists(e => e.ETD == LastEtd)) + { + var 最晚业务 = headList.Where(x => x.ETD == LastEtd).ToList(); + //有其他未签出的 且用于判断的这些业务是ETD最晚的 是最后一票 + var custnoStr = "单号[" + string.Join(",", 最晚业务.Select(s => s.CUSTNO).Distinct().ToArray()) + "]ATD:" + LastEtd + ",此后无单"; - result.OK($"最后开船的{headList.Count}票,"+ custnoStr+"", true); + result.OK($"最后开船的{headList.Count}票," + custnoStr + "", true); + } + else + { + //有其他未签出的 但用于判断的这些业务不是ETD最晚的 不是最后一票 + result.OK("", false); + } } - else { - //有其他未签出的 但用于判断的这些业务不是ETD最晚的 不是最后一票 - result.OK("", false); + else + { + //没有其他未签出的业务了 是最后一票 + result.OK($"警示!!!该客户仅剩此{headList.Count}票", true); } } - else - { - //没有其他未签出的业务了 是最后一票 - result.OK($"警示!!!该客户仅剩此{headList.Count}票", true); + catch (Exception e) { + result.SetErrorInfo(e.Message); } - return result; } @@ -3995,38 +3994,93 @@ namespace DSWeb.Areas.MvcShipping.DAL.MsOp_BLISSUE return result; } + public static DBResult 是否全部特放审核通过(string BSNO) + { + var result = new DBResult(); + var cdc = new CommonDataContext(); + var bsnoList = BSNO.Replace("'", "").Split(',').ToList(); + + + var 特放明细List = cdc.v_op_blissuelist_Detail.Where(x => bsnoList.Contains(x.bsno)); + var 特放审核通过 = true; + foreach (var bsno in bsnoList) + { + var 审批通过的特放明细 = 特放明细List.Where(x => x.bsno == bsno && x.BLSTATUS == "审核通过").ToList(); + var 未审批通过的特放明细 = 特放明细List.Where(x => x.bsno == bsno && x.BLSTATUS != "审核通过").ToList(); + + + if (审批通过的特放明细 != null && 审批通过的特放明细.Count > 0 && (未审批通过的特放明细 == null || 未审批通过的特放明细.Count == 0)) + { + + } + else + { + 特放审核通过 = false; + break; + } + } + if (特放审核通过) + { + result.OK(); + } + else { + result.SetErrorInfo(""); + + } + return result; + } + + /// /// 是否财务扣单 - /// 由财务扣单的业务 不可以申请特放 + /// 由财务扣单的业务 不可以申请特放; + /// 如有财务扣单 返回true,如无返回false /// /// /// public static DBResult ISKDWithCW(string BSNO) + { + + var _recount = 0; + var headList = GetDataList(" B.BSNO in (" + BSNO + ") and oB.blstatus='扣单' ", 0, 999, out _recount); + + return ISKDWithCW(headList); + } + /// + /// 是否财务扣单 + /// 由财务扣单的业务 不可以申请特放; + /// 如有财务扣单 返回true,如无返回false + /// + /// + /// + public static DBResult ISKDWithCW(List headList) { var result = new DBResult(); result.SetErrorInfo("没有财务角色扣单"); - var _recount = 0; - var headList = GetDataList(" B.BSNO in (" + BSNO + ") and oB.blstatus='扣单' ", 0, 999, out _recount); + //var _recount = 0; + //var headList = GetDataList(" B.BSNO in (" + BSNO + ") and oB.blstatus='扣单' ", 0, 999, out _recount); - if (headList != null && headList.Count > 0) { + if (headList != null && headList.Count > 0) + { var 特放GIDList = headList.Select(s => s.GID).ToList(); var cdc = new CommonDataContext(); - var 扣单动作日志 = cdc.WorkLog.Where(x => 特放GIDList.Contains(x.BSNO) && x.ACTNAME==BLSTATUSTYPE.扣单).ToList(); + var 扣单动作日志 = cdc.WorkLog.Where(x => 特放GIDList.Contains(x.BSNO) && x.ACTNAME == BLSTATUSTYPE.扣单).ToList(); - var 扣单执行人UseridList= 扣单动作日志.Select(s=>s.OP).Distinct().ToList(); + var 扣单执行人UseridList = 扣单动作日志.Select(s => s.OP).Distinct().ToList(); var 角色List = 获取角色列表(); - var 财务角色IDList = 角色List.Where(x => x.GVALUE.Contains("财务")).Select(s=>s.GID).ToList(); + var 财务角色IDList = 角色List.Where(x => x.GVALUE.Contains("财务")).Select(s => s.GID).ToList(); var 扣单财务人员角色IDList = cdc.user_role.Where(x => 扣单执行人UseridList.Contains(x.USERID) && 财务角色IDList.Contains(x.ROLEID)).ToList(); - if (扣单财务人员角色IDList.Count > 0) { + if (扣单财务人员角色IDList.Count > 0) + { var 扣单USERID = 扣单财务人员角色IDList[0].USERID; var 扣单动作 = 扣单动作日志.First(x => x.OP == 扣单USERID); var head = headList.First(x => x.GID == 扣单动作.BSNO); - var msg = $"存在一个由财务扣单的业务,不能执行特殊放单申请【{head.CUSTNO}】"; + var msg = $"存在一个由财务扣单的业务,不能执行放货或特殊放单申请【{head.CUSTNO}】"; result.OK(msg); return result; } diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js index 06899b92..7819b0f7 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js @@ -8122,18 +8122,18 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { // _this2.winFDTZShow.close(); // } //}, - { - text: Zi.LAN.btnprint, //"打印", + text: Zi.LAN.TFSQ, //"特放申请", minWidth: 70, handler: function () { - _this2.Print_FDTZ(); + _this2.TFSQ(); } - }, { - text: Zi.LAN.TFSQ, //"特放申请", + }, + { + text: Zi.LAN.btnprint, //"打印", minWidth: 70, handler: function () { - _this2.TFSQ(); + _this2.Print_FDTZ(); } }] });