From d3b850eb378a58dcbaa32868e29d264e9310ceea Mon Sep 17 00:00:00 2001 From: qian Date: Tue, 14 Nov 2023 14:47:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E5=88=97asnbillnumber=20=E6=A0=87=E5=8C=85=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=94=B9=E6=88=90qty=20=20=E8=A1=8C=E5=8F=B7=E6=94=B9=E6=88=90?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/SCP_PO_CONTROLLER.cs | 3 +- Controller/UniApiController.cs | 69 +++++++++---------- Models/UniApiEntity/PURReplenishQty.cs | 4 ++ .../Controller/OdbcApiScpController.cs | 5 +- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/Controller/SCP_PO_CONTROLLER.cs b/Controller/SCP_PO_CONTROLLER.cs index a342ed8..6c52776 100644 --- a/Controller/SCP_PO_CONTROLLER.cs +++ b/Controller/SCP_PO_CONTROLLER.cs @@ -816,7 +816,8 @@ namespace CK.SCP.Controller private static List CheckExce2(ScpEntities db, string lt) { List ErrorList = new List(); - var _asn = db.TB_ASN_DETAIL.Count(p => p.PoBillNum ==lt); + // 刨除作废的单子 + var _asn = db.TB_ASN_DETAIL.Count(p => (p.PoBillNum ==lt) && (p.State != (int)AsnState.Reject )); if (_asn> 0) { ErrorList.Add(string.Format("订单【{0}】已经生成发货单了,不能作废", lt)); diff --git a/Controller/UniApiController.cs b/Controller/UniApiController.cs index 1dec096..b87daad 100644 --- a/Controller/UniApiController.cs +++ b/Controller/UniApiController.cs @@ -274,7 +274,6 @@ namespace CK.SCP.Controller { var tableName = GetTableName(uniApiType); var apiData = new TS_UNI_API(); - apiData.InterfaceType = uniApiType.ToString(); apiData.TableName = tableName.ToString(); apiData.BillNum = bill.AsnBillNum; @@ -298,47 +297,47 @@ namespace CK.SCP.Controller var ts = db.TS_UNI_API.Count(p => p.ErpLineNum == detail.PoLine && p.ErpBillNum == bill.PoBillNum); string str = "000"; string st = bill.PoBillNum.Substring(0,4); - if (ts == 0) - { + //if (ts == 0) + //{ string str1= detail.PoLine.ToString(); apiData.Extend3 = str1; - } - else - { - if (ts == 1) - { - var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); - int ts2 = ts1 + 50; - string str2 = ts2.ToString(); + //} + //else + // { + // if (ts == 1) + // { + // var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); + // int ts2 = ts1 + 50; + // string str2 = ts2.ToString(); - apiData.Extend3 = str2; - } - else if (ts == 2) - { - var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); - int ts2 = ts1 + 60; - string str3 = ts2.ToString(); + // apiData.Extend3 = str2; + // } + // else if (ts == 2) + // { + // var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); + // int ts2 = ts1 + 60; + // string str3 = ts2.ToString(); - apiData.Extend3 = str3; - } - else if (ts == 3) - { - var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); - int ts2 = ts1 + 70; - string str4 = ts2.ToString(); + // apiData.Extend3 = str3; + // } + // else if (ts == 3) + // { + // var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max(); + // int ts2 = ts1 + 70; + // string str4 = ts2.ToString(); - apiData.Extend3 = str4; - } - else - { - var ts3 = db.TS_UNI_API.Where(p => p.ErpLineNum == detail.PoLine && p.ErpBillNum == bill.PoBillNum).Select(r => r.Extend3).Max(); - int ts4 = int.Parse(ts3) + 10; - string str5 = ts4.ToString(); + // apiData.Extend3 = str4; + // } + // else + // { + // var ts3 = db.TS_UNI_API.Where(p => p.ErpLineNum == detail.PoLine && p.ErpBillNum == bill.PoBillNum).Select(r => r.Extend3).Max(); + // int ts4 = int.Parse(ts3) + 10; + // string str5 = ts4.ToString(); - apiData.Extend3 = str5; - } - } + // apiData.Extend3 = str5; + // } + // } if (bill.SubSite == "W21") { apiData.VendBatch = detail.UpdateUser; diff --git a/Models/UniApiEntity/PURReplenishQty.cs b/Models/UniApiEntity/PURReplenishQty.cs index 20685c8..ce877a1 100644 --- a/Models/UniApiEntity/PURReplenishQty.cs +++ b/Models/UniApiEntity/PURReplenishQty.cs @@ -11,6 +11,10 @@ namespace CK.SCP.Models.UniApiEntity public string PURDOCNO { get; set; } public string purDocLineNO { get; set; } public decimal replenishQty { get; set; } + /// + /// asn单号 + /// + public string PurAsnBillNum { get; set; } public string client { get; set; } public string plant { get; set; } } diff --git a/UniApiGroup/Controller/OdbcApiScpController.cs b/UniApiGroup/Controller/OdbcApiScpController.cs index 0bb50b2..f244b67 100644 --- a/UniApiGroup/Controller/OdbcApiScpController.cs +++ b/UniApiGroup/Controller/OdbcApiScpController.cs @@ -91,7 +91,10 @@ namespace CK.SCP.GrupUniApi.Controller { PURDOCNO = erpData.ErpBillNum, purDocLineNO = erpData.Extend3, - replenishQty = erpData.PackQty, + // 增加一列BillNum 用来区分 + PurAsnBillNum = erpData.BillNum, + // 发货单里的qty + replenishQty = erpData.Qty, client = "800", plant = erpData.Site