From daba65621fbf5ebe89725e070779a0cbbad3244e Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Thu, 3 Sep 2020 11:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E9=83=BD=E9=9D=92=E5=B2=9B=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/SCP_ASK_CONTROLLER.cs | 21 + Controller/SCP_ASN_CONTROLLER.cs | 541 ++++++++++++++++- Controller/SCP_BARCODE_CONTROLLER.cs | 380 +++++++++++- Controller/SCP_BILLCODE_CONTROLLER.cs | 38 ++ Controller/SCP_EXCEL_CONTROLLER.cs | 7 +- Controller/SCP_PALLET_CONTROLLER.cs | 74 +++ Controller/SCP_PLAN_MONTH_CONTROLLER.cs | 51 ++ Controller/SCP_PO_CONTROLLER.cs | 8 +- Controller/SCP_TS_BARCODE_CONTROLLER.cs | 142 +++++ Models/CK.SCP.Models.csproj | 4 + Models/Enums/SCP_ENUM.cs.cs | 4 + Models/ScpCache.cs | 2 +- Models/ScpEntities.cs | 4 + .../SCP_ASK_DETAIL_EXPORT.cs | 2 +- .../SCP_PO_DETAIL_EXPORT.cs | 17 - .../SCP_VENDER_PART_EXPORT.cs | 1 + Models/ScpEntity/TA_VENDER.cs | 2 +- Models/ScpEntity/TA_VEND_PART.cs | 4 +- Models/ScpEntity/TB_PALLETS.cs | 26 + Models/ScpEntity/TS_BARCODE_RULE_SMALL.cs | 32 + Models/ScpEntity/TS_BARCODE_SMALL.cs | 101 +++ Models/ScpEntity/V_ASN_PRINT.cs | 2 +- Models/ScpEntity/V_TA_VEND_PART.cs | 1 + Models/ScpEntity/V_TB_ASK_DETAIL.cs | 3 - Models/ScpEntity/V_TB_ASN_DETAIL.cs | 2 +- Models/ScpEntity/V_TB_PALLETS.cs | 22 + SCP/Common/ReportHelper.cs | 89 ++- SCP/SCP.csproj | 50 +- SCP/Views/BasicData/SCP_TA_VEND_PART.aspx | 1 + SCP/Views/PlanData/PlanMonth.aspx | 110 ++++ SCP/Views/PlanData/PlanMonth.aspx.cs | 272 +++++++++ .../PlanMonth.aspx.designer.cs} | 133 +++- SCP/Views/PlanData/PlanMonthEdit.aspx | 44 ++ SCP/Views/PlanData/PlanMonthEdit.aspx.cs | 113 ++++ .../PlanMonthEdit.aspx.designer.cs} | 49 +- SCP/Views/PlanData/SCP_ASK_DETAIL.aspx | 2 +- SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx | 32 +- .../PlanData/SCP_ASN_DETAIL_View.aspx.cs | 7 + SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs | 8 - SCP/Views/PlanData/SCP_PO.aspx | 18 +- SCP/Views/PlanData/SCP_PO.aspx.cs | 2 +- SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx | 12 +- SCP/Views/PlanData/SCP_PO_DETAIL.aspx | 36 +- SCP/Views/PlanData/SCP_PO_DETAIL.aspx.cs | 7 +- SCP/Views/SupplierData/PlanMonth.aspx | 104 ++++ SCP/Views/SupplierData/PlanMonth.aspx.cs | 191 ++++++ .../PlanMonth.aspx.designer.cs} | 82 ++- SCP/Views/SupplierData/SCP_ASK.aspx | 2 +- SCP/Views/SupplierData/SCP_ASN.aspx | 3 - SCP/Views/SupplierData/SCP_ASN.aspx.cs | 19 +- .../SupplierData/SCP_ASN.aspx.designer.cs | 9 - SCP/Views/SupplierData/SCP_ASN_CREATE.aspx | 8 - .../SCP_ASN_CREATE.aspx.designer.cs | 9 - SCP/Views/SupplierData/SCP_ASN_DETAIL.aspx.cs | 21 +- .../SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx | 2 +- .../PlanData/SCP_ASK.aspx | 39 +- .../PlanData/SCP_ASK.aspx.cs | 88 ++- .../PlanData/SCP_ASK.aspx.designer.cs | 160 +++-- .../PlanData/SCP_PO.aspx | 76 +-- .../PlanData/SCP_PO.aspx.cs | 19 +- .../PlanData/SCP_PO.aspx.designer.cs | 124 ++-- .../PlanData/SCP_PO_CREATE_ASK.aspx | 80 ++- .../PlanData/SCP_PO_CREATE_ASK.aspx.cs | 84 ++- .../SCP_PO_CREATE_ASK.aspx.designer.cs | 175 +++++- .../SupplierData/PlanDetail.aspx | 99 --- .../SupplierData/PlanDetail.aspx.cs | 90 --- .../SupplierData/SCP_ASK.aspx | 50 +- .../SupplierData/SCP_ASK.aspx.cs | 73 ++- .../SupplierData/SCP_ASK.aspx.designer.cs | 186 ++++-- .../SupplierData/SCP_ASK_DETAIL.aspx | 12 +- .../SupplierData/SCP_ASN.aspx | 135 +++++ .../SupplierData/SCP_ASN.aspx.cs | 203 +++++++ .../SupplierData/SCP_ASN.aspx.designer.cs | 323 ++++++++++ .../SupplierData/SCP_ASN_CREATE.aspx | 12 +- .../SupplierData/SCP_ASN_CREATE.aspx.cs | 31 +- .../SCP_ASN_CREATE.aspx.designer.cs | 118 ++-- .../SupplierData/SCP_ASN_DETAIL.aspx | 184 ++++++ .../SupplierData/SCP_ASN_DETAIL.aspx.cs | 573 ++++++++++++++++++ .../SCP_ASN_DETAIL.aspx.designer.cs | 332 ++++++++++ .../SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx | 57 -- .../SCP_SHIP_DETAIL_BARCODE.aspx.cs | 89 --- .../SupplierData/SCP_TS_BARCODE.aspx | 61 -- .../SupplierData/SCP_TS_BARCODE.aspx.cs | 82 --- SCP/default.aspx | 4 +- SCP/default.aspx.designer.cs | 321 ++++++++++ 85 files changed, 5740 insertions(+), 1066 deletions(-) create mode 100644 Models/ScpEntity/TB_PALLETS.cs create mode 100644 Models/ScpEntity/TS_BARCODE_RULE_SMALL.cs create mode 100644 Models/ScpEntity/TS_BARCODE_SMALL.cs create mode 100644 Models/ScpEntity/V_TB_PALLETS.cs create mode 100644 SCP/Views/PlanData/PlanMonth.aspx create mode 100644 SCP/Views/PlanData/PlanMonth.aspx.cs rename SCP/Views/{青岛一汽法雷奥/SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx.designer.cs => PlanData/PlanMonth.aspx.designer.cs} (50%) create mode 100644 SCP/Views/PlanData/PlanMonthEdit.aspx create mode 100644 SCP/Views/PlanData/PlanMonthEdit.aspx.cs rename SCP/Views/{青岛一汽法雷奥/SupplierData/SCP_TS_BARCODE.aspx.designer.cs => PlanData/PlanMonthEdit.aspx.designer.cs} (75%) create mode 100644 SCP/Views/SupplierData/PlanMonth.aspx create mode 100644 SCP/Views/SupplierData/PlanMonth.aspx.cs rename SCP/Views/{青岛一汽法雷奥/SupplierData/PlanDetail.aspx.designer.cs => SupplierData/PlanMonth.aspx.designer.cs} (70%) delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/PlanDetail.aspx delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/PlanDetail.aspx.cs create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN.aspx create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN.aspx.cs create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN.aspx.designer.cs create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN_DETAIL.aspx create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN_DETAIL.aspx.cs create mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_ASN_DETAIL.aspx.designer.cs delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx.cs delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_TS_BARCODE.aspx delete mode 100644 SCP/Views/青岛一汽法雷奥/SupplierData/SCP_TS_BARCODE.aspx.cs create mode 100644 SCP/default.aspx.designer.cs diff --git a/Controller/SCP_ASK_CONTROLLER.cs b/Controller/SCP_ASK_CONTROLLER.cs index 6c55e0e..113bdcb 100644 --- a/Controller/SCP_ASK_CONTROLLER.cs +++ b/Controller/SCP_ASK_CONTROLLER.cs @@ -1659,6 +1659,27 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { + if (p_state == AskState.Close) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + if (_ls.Count > 0) + { + _ls.ForEach(p => { + p.State = (int)AskState.Close; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => itm.State = (int)AskState.Close); + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + } + ); + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录,不能关闭!"; + } + } if (p_state == AskState.Confirm) { var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); diff --git a/Controller/SCP_ASN_CONTROLLER.cs b/Controller/SCP_ASN_CONTROLLER.cs index a8e8274..c2ae84f 100644 --- a/Controller/SCP_ASN_CONTROLLER.cs +++ b/Controller/SCP_ASN_CONTROLLER.cs @@ -117,6 +117,14 @@ namespace CK.SCP.Controller //{ // q = q.Where(p => p.Contacter.Contains(p_entity.Contacter)); //} + if (p_entity.ShipTime != null) + { + q = q.Where(p => p.ShipTime == p_entity.ShipTime); + } + if (p_entity.ReceiveTime != null) + { + q = q.Where(p => p.ReceiveTime == p_entity.ReceiveTime); + } if (!string.IsNullOrEmpty(p_entity.Buyer)) { q = q.Where(p => p.Buyer.Contains(p_entity.Buyer)); @@ -222,6 +230,84 @@ namespace CK.SCP.Controller throw e; } } + public static void Get_TB_Pallet_List(V_TB_PALLETS p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.V_TB_PALLETS; + if (!string.IsNullOrEmpty(p_entity.AsnBillNum)) + { + q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum)); + } + if (p_entity.Qty != 0) + { + q = q.Where(p => p.Qty == p_entity.Qty); + } + if (!string.IsNullOrEmpty(p_entity.PartCode)) + { + q = q.Where(p => p.PartCode.Contains(p_entity.PartCode)); + } + if (!string.IsNullOrEmpty(p_entity.Batch)) + { + q = q.Where(p => p.Batch.Contains(p_entity.Batch)); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = q; + p_action(_ret); + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TB_Pallet_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TB_Pallet_List", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TB_Pallet_List", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TB_Pallet_List", e.Message); + throw e; + } + } public static void Get_V_TB_ASN_DETAIL_List(V_TB_ASN_DETAIL p_entity, Action>> p_action) { ResultObject> _ret = new ResultObject>(); @@ -562,7 +648,7 @@ namespace CK.SCP.Controller _print.CAAIPhone = ""; _print.CAAIFax = ""; _print.Site = _asn.Site; - + _print.Total = "0"; using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance()) { StringBuilder _buffer = new StringBuilder(); @@ -619,6 +705,70 @@ namespace CK.SCP.Controller return ds; } + public static DataSet ASN_PALLET_REPORT(string p_AsnBillNum) + { + DataSet ds = new DataSet(); + SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(new V_TB_ASN { AsnBillNum = p_AsnBillNum }, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + if (ret.Result.Count() > 0) + { + var _asn = ret.Result.FirstOrDefault(); + V_ASN_PRINT _print = new V_ASN_PRINT(); + _print.FileNo = ""; + _print.DeliveryNo = _asn.AsnBillNum; + _print.ChineseAddress = _asn.Site_Desc; + _print.EnglishAddress = ""; + _print.SupplierNo = _asn.VendId; + _print.SupplierName = _asn.VendName; + _print.SupplierContacter = _asn.ShipUser; + _print.DueDeliveryDate = _asn.ReceiveTime.ToString(); + _print.MaterialPlanner = _asn.Buyer; + _print.CAAIPhone = ""; + _print.CAAIFax = ""; + _print.Total = "0"; + using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance()) + { + StringBuilder _buffer = new StringBuilder(); + var _ls = _appdb.Users.Where(p => p.Roles.Select(itm => itm.Name).Contains("物流人员")).ToList(); + _ls.ForEach(itm => + { + _buffer.Append(itm.ChineseName + "/" + itm.CellPhone + ";"); + }); + _print.CAAIPhone = _buffer.ToString(); + } + SCP_ASN_CONTROLLER.Get_TB_Pallet_List(new V_TB_PALLETS() { AsnBillNum = p_AsnBillNum }, (retobj) => + { + if (retobj.State == ReturnStatus.Succeed) + { + List _lsDetail = new List(); + var _ls = retobj.Result.ToList(); + decimal count = 0; + _ls.ForEach(p => + { + V_TB_PALLETS _detail = new V_TB_PALLETS(); + _detail.PartCode = p.PartCode; + _detail.PartName = p.PartName; + _detail.PalletNum = p.PalletNum; + _detail.Batch = p.Batch; + _detail.Qty = p.Qty; + _detail.Box = p.Box; + count += p.Qty; + _lsDetail.Add(_detail); + }); + _print.Total = count.ToString(); + var tb = ConvertHelper.ToDataTable(_lsDetail); + ds.Tables.Add(tb); + } + }); + var dt = ConvertHelper.ToDataTable(new List { _print }); + ds.Tables.Add(dt); + } + } + }); + return ds; + } public static DataSet ARRIVE_REPORT(string p_AsnBillNum) { DataSet ds = new DataSet(); @@ -968,8 +1118,184 @@ namespace CK.SCP.Controller + public static ResultObject Save_TB_CREATE_SMALLBARCODE(List p_list) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + List _ls = new List(); + if (p_list.Count > 0) + { + string _asnBillNum = p_list[0].AsnBillNum; + var _asn = db.TB_ASN.Where(p => p.IsDeleted == false && p.AsnBillNum == _asnBillNum).FirstOrDefault(); + List _asnList = new List(); + p_list.ForEach(p => + { + var _askDetail = db.TA_VEND_PART.Where(itm => itm.VendId == p.VendId && itm.PartCode == p.PartCode).FirstOrDefault(); + if (_askDetail != null) + { + decimal _qty = 0; + decimal _smallpackQty = 0; + if (decimal.TryParse(p.Qty.ToString(), out _qty) && decimal.TryParse(_askDetail.MinPackQty.ToString(), out _smallpackQty)) + { + if (_smallpackQty == 0) + { + _ret.MessageList.Add("供应商:" + p.VendId + "零件号:" + p.PartCode + "最小包装为0!"); + } + else + { + decimal _n = _qty / _smallpackQty; + var _count = int.Parse(Math.Truncate(_n).ToString()); + if (_qty / _smallpackQty > 0) + { + for (int i = 0; i < _count; i++) + { + V_TB_ASN_DETAIL _asndetail = new V_TB_ASN_DETAIL(); + _asndetail.PoBillNum = p.PoBillNum; + _asndetail.Batch = p.Batch; + _asndetail.PartCode = p.PartCode; + _asndetail.ProduceDate = p.ProduceDate; + _asndetail.Qty = _smallpackQty; + _asndetail.AsnBillNum = p.AsnBillNum; + _asndetail.PoLine = p.PoLine; + _asndetail.VendId = p.VendId; + _asndetail.VendBatch = p.VendBatch; + _asndetail.CreateTime = p.CreateTime; + _asndetail.CreateUser = p.CreateUser; + _asndetail.Remark = p.Remark; + _asndetail.PackQty = _smallpackQty;//小包装 + _asndetail.PoUnit = p.PoUnit; + _asndetail.Site = p.Site; + _asnList.Add(_asndetail); + } + if (_qty % _smallpackQty > 0) + { + V_TB_ASN_DETAIL _asndetail = new V_TB_ASN_DETAIL(); + _asndetail.PoBillNum = p.PoBillNum; + _asndetail.Batch = p.Batch; + _asndetail.PartCode = p.PartCode; + _asndetail.ProduceDate = p.ProduceDate; + _asndetail.Qty = _qty % _smallpackQty; + _asndetail.AsnBillNum = p.AsnBillNum; + _asndetail.PoLine = p.PoLine; + _asndetail.VendId = p.VendId; + _asndetail.VendBatch = p.VendBatch; + _asndetail.CreateTime = p.CreateTime; + _asndetail.CreateUser = p.CreateUser; + _asndetail.Remark = p.Remark; + _asndetail.PackQty = _smallpackQty;//小包装 + _asndetail.PoUnit = p.PoUnit; + _asndetail.Site = p.Site; + _asnList.Add(_asndetail); + } + } + else + { + if (_qty > 0) + { + V_TB_ASN_DETAIL _asndetail = new V_TB_ASN_DETAIL(); + _asndetail.PoBillNum = p.PoBillNum; + _asndetail.Batch = p.Batch; + _asndetail.PartCode = p.PartCode; + _asndetail.ProduceDate = p.ProduceDate; + _asndetail.Qty = _qty; + _asndetail.AsnBillNum = p.AsnBillNum; + _asndetail.PoLine = p.PoLine; + _asndetail.VendId = p.VendId; + _asndetail.VendBatch = p.VendBatch; + _asndetail.CreateTime = p.CreateTime; + _asndetail.CreateUser = p.CreateUser; + _asndetail.Remark = p.Remark; + _asndetail.PackQty = _smallpackQty;//小包装 + _asndetail.PoUnit = p.PoUnit; + _asndetail.Site = p.Site; + _asnList.Add(_asndetail); + } + } + } + } + } + }); + foreach (var itm in _asnList) + { + var _bar = SCP_BARCODE_CONTROLLER.CreateSmallBarcode(itm); + _ls.Add(_bar); + } + db.TS_BARCODE_SMALL.AddOrUpdate(p => new { p.BarCode, p.BillNum }, _ls.ToArray()); + } + else + { + _ret.MessageList.Add("选择的发货明细数量为零!"); + } + if (_ret.MessageList.Count == 0) + { + if (db.SaveChanges() != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + } + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_CREATE_BARCODE", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_CREATE_BARCODE", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_CREATE_BARCODE", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_DETAIL", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } public static ResultObject Save_TB_CREATE_BARCODE(List p_list) { @@ -1145,6 +1471,219 @@ namespace CK.SCP.Controller } return _ret; } + public static ResultObject Save_TB_PALLET(List p_list) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + List _list = new List(); + int codenum = 1; //标签计数器 + string _oldpartcode = ""; //上一个托盘所装零件编号 + decimal _oldbox = 0; //上一个托盘箱数计数 + string _oldpalletnum = "";//上一个托盘码 + List _listm = new List(); + p_list.ForEach(p => + { + var _askDetail = db.TA_VEND_PART.Where + (itm => itm.VendId == p.VendId + && itm.PartCode == p.PartCode + ).FirstOrDefault(); + if (_askDetail != null) + { + var _palletPack = _askDetail.PalletPackQty; + #region 补充未满托盘 + if (p.PartCode== _oldpartcode) + { + decimal _box1 = 0; + int _TempQty1 = Convert.ToInt32(p.Qty); + int _PackQty1 = Convert.ToInt32(p.PackQty); + if (_TempQty1 / _PackQty1 > 0) + { + int _count = _TempQty1 / _PackQty1; + _box1 += _count; + if (p.Qty % p.PackQty > 0) + { + _box1++; + } + } + else + { + if (_TempQty1 > 0) + { + _box1++; + } + } + if(_box1< _oldbox) + { + TB_PALLETS pallet = new TB_PALLETS(); + pallet.AsnBillNum = p.AsnBillNum; + pallet.PartCode = p.PartCode; + pallet.Batch = p.Batch; + pallet.VendId = p.VendId; + pallet.Box = Convert.ToInt32(_box1); + pallet.Qty = p.Qty; + pallet.PalletNum = _oldpalletnum; + db.TB_PALLETS.Add(pallet); + p.Qty = 0; + } + else + { + TB_PALLETS pallet = new TB_PALLETS(); + pallet.AsnBillNum = p.AsnBillNum; + pallet.PartCode = p.PartCode; + pallet.Batch = p.Batch; + pallet.VendId = p.VendId; + pallet.Box = Convert.ToInt32(_oldbox); + pallet.Qty = _oldbox* _PackQty1; + pallet.PalletNum = _oldpalletnum; + db.TB_PALLETS.Add(pallet); + p.Qty = p.Qty- _oldbox * _PackQty1; + } + } + #endregion + #region 新托盘 + if (p.Qty != 0) + { + decimal _box = 0; + int _TempQty = Convert.ToInt32(p.Qty); + int _PackQty = Convert.ToInt32(p.PackQty); + if (_TempQty / _PackQty > 0) + { + int _count = _TempQty / _PackQty; + _box += _count; + if (p.Qty % p.PackQty > 0) + { + _box++; + } + } + else + { + if (_TempQty > 0) + { + _box++; + } + } + if (_box <= _palletPack) + { + TB_PALLETS pallet = new TB_PALLETS(); + pallet.AsnBillNum = p.AsnBillNum; + pallet.PartCode = p.PartCode; + pallet.Batch = p.Batch; + pallet.VendId = p.VendId; + pallet.Box = Convert.ToInt32(_box); + pallet.Qty = p.Qty; + pallet.PalletNum = SCP_BILLCODE_CONTROLLER.MakePalletCode_QD(codenum); + db.TB_PALLETS.Add(pallet); + _oldpartcode = p.PartCode; + _oldbox = Convert.ToInt32(_palletPack) - _box; + _oldpalletnum = pallet.PalletNum; + codenum++; + } + else + { + decimal _pallet = 0; + _pallet += Convert.ToInt32(_box) / Convert.ToInt32(_palletPack); + if (_box % _palletPack > 0) + { + _pallet++; + } + for (int i = 1; i <= _pallet;i++) + { + TB_PALLETS pallet = new TB_PALLETS(); + pallet.AsnBillNum = p.AsnBillNum; + pallet.PartCode = p.PartCode; + pallet.Batch = p.Batch; + pallet.VendId = p.VendId; + pallet.PalletNum = SCP_BILLCODE_CONTROLLER.MakePalletCode_QD(codenum); + if (i == _pallet) + { + pallet.Box = Convert.ToInt32(_box - Convert.ToDecimal(_palletPack) * (_pallet - 1)); + pallet.Qty = p.Qty - Convert.ToDecimal(_palletPack) * (_pallet - 1) * _PackQty; + } + else + { + pallet.Box = Convert.ToInt32(_palletPack); + pallet.Qty = Convert.ToDecimal(_palletPack) * _PackQty; + } + db.TB_PALLETS.Add(pallet); + codenum++; + } + } + } + #endregion + } + else + { + string _str = string.Format("零件号:{0},供应商编号:{1},没有维护托盘标包数!请先维护供应商零件信息", p.PartCode, p.VendBatch); + _list.Add(_str); + } + }); + int state = db.SaveChanges(); + if (state != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.MessageList = _listm; + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } public static ResultObject Save_TB_CREATE_BARCODE_SYJB(List p_list) { ResultObject _ret = new ResultObject(); diff --git a/Controller/SCP_BARCODE_CONTROLLER.cs b/Controller/SCP_BARCODE_CONTROLLER.cs index 05ae890..5ba7830 100644 --- a/Controller/SCP_BARCODE_CONTROLLER.cs +++ b/Controller/SCP_BARCODE_CONTROLLER.cs @@ -331,6 +331,265 @@ namespace CK.SCP.Controller } + public static void Get_TS_BARCODE_SMALL_List(TS_BARCODE_SMALL p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.TS_BARCODE_SMALL; + if (!string.IsNullOrEmpty(p_entity.BarCode)) + { + q = q.Where(p => p.BarCode == p_entity.BarCode); + } + if (!string.IsNullOrEmpty(p_entity.FullBarCode)) + { + q = q.Where(p => p.FullBarCode == p_entity.FullBarCode); + } + if (!string.IsNullOrEmpty(p_entity.PartCode)) + { + q = q.Where(p => p.PartCode == p_entity.PartCode); + } + if (!string.IsNullOrEmpty(p_entity.VendPartCode)) + { + q = q.Where(p => p.VendPartCode == p_entity.VendPartCode); + } + if (!string.IsNullOrEmpty(p_entity.Batch)) + { + q = q.Where(p => p.Batch == p_entity.Batch); + } + if (p_entity.ManageType != 0) + { + q = q.Where(p => p.ManageType == p_entity.ManageType); + } + if (!string.IsNullOrEmpty(p_entity.SerialNum)) + { + q = q.Where(p => p.SerialNum.Contains(p_entity.SerialNum)); + } + if (p_entity.Qty != 0) + { + q = q.Where(p => p.Qty == p_entity.Qty); + } + if (p_entity.BarCodeType != 0) + { + q = q.Where(p => p.BarCodeType == p_entity.BarCodeType); + } + if (!string.IsNullOrEmpty(p_entity.BillNum)) + { + q = q.Where(p => p.BillNum.Contains(p_entity.BillNum)); + } + if (p_entity.PoBillLine != 0) + { + q = q.Where(p => p.PoBillLine == p_entity.PoBillLine); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + if (!string.IsNullOrEmpty(p_entity.VendBatch)) + { + q = q.Where(p => p.VendBatch == p_entity.VendBatch); + } + if (p_entity.SmallPackQty != 0) + { + q = q.Where(p => p.SmallPackQty == p_entity.SmallPackQty); + } + if (!string.IsNullOrEmpty(p_entity.CreateOper)) + { + q = q.Where(p => p.CreateOper.Contains(p_entity.CreateOper)); + } + if (p_entity.State != 0) + { + q = q.Where(p => p.State == p_entity.State); + } + if (!string.IsNullOrEmpty(p_entity.Remark)) + { + q = q.Where(p => p.Remark.Contains(p_entity.Remark)); + } + if (!string.IsNullOrEmpty(p_entity.PoUnit)) + { + q = q.Where(p => p.PoUnit.Contains(p_entity.PoUnit)); + } + if (!string.IsNullOrEmpty(p_entity.LocUnit)) + { + q = q.Where(p => p.LocUnit.Contains(p_entity.LocUnit)); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = q; + p_action(_ret); + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//ʵ֤쳣 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("{0}ֶΣ{1}Ϣ{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "ֶ֤ʧ" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//ͻ쳣 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", e.Message); + throw e; + } + } + public static ResultObject> CreateSmallBarcodeList(V_TB_ASN_DETAIL p_entity, int cnt = 1) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + var list = new List(); + var part = db.TA_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode); + if (part == null) + { + _ret.MessageList.Add("Ϣδҵñ!"); + } + var vendPart= db.TA_VEND_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.VendId == p_entity.VendId); + var ret = GetSmallBarcodeRule(p_entity.PartCode, p_entity.Batch, cnt); + var _part = db.TA_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.Site == p_entity.Site); + if (ret.State == ReturnStatus.Succeed) + { + var barcodeRule = ret.Result; + for (int i = cnt; i > 0; i--) + { + var createTime = ScpCache.GetServerTime(); + var code = GetLastSmallBarCode(p_entity.PartCode, p_entity.Batch, barcodeRule.LastNumber - i + 1); + if (part.PartDesc1.ToUpper().Contains("") || part.PartDesc1.ToUpper().Contains("LEFT") || + part.PartDesc2.ToUpper().Contains("") || part.PartDesc2.ToUpper().Contains("LEFT")) + p_entity.Remark = "L" + p_entity.Remark; + if (part.PartDesc1.ToUpper().Contains("") || part.PartDesc1.ToUpper().Contains("RIGHT") || + part.PartDesc2.ToUpper().Contains("") || part.PartDesc2.ToUpper().Contains("RIGHT")) + p_entity.Remark = "R" + p_entity.Remark; + string _check = (_part.Ischeck == false || _part.Ischeck == null) ? "" : "()"; + var barcode = new TS_BARCODE_SMALL + { + BarCode = code, + PartCode = part.PartCode, + VendPartCode = vendPart?.VendPartCode, + Batch = p_entity.Batch, + ProduceDate = (DateTime)p_entity.ProduceDate, + SerialNum = barcodeRule.LastNumber.ToString(ScpCache.Config.кŸʽ), + PoUnit = p_entity.PoUnit, + Qty = p_entity.Qty, + BarCodeType = 1, + BillNum = p_entity.AsnBillNum, + PoBillNum = p_entity.PoBillNum, + PoBillLine = p_entity.PoLine, + VendId = p_entity.VendId, + VendBatch = p_entity.VendBatch, + CreateTime = p_entity.CreateTime, + CreateOper = p_entity.CreateUser, + State = 0, + Remark = p_entity.Remark, + SmallPackQty = p_entity.PackQty, + Site = p_entity.Site + }; + if (_part == null) + { + _ret.MessageList.Add("δҵ,ŻصϢ," + p_entity.PartCode); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBarcodeList", "δҵ,ŻصϢ," + p_entity.PartCode); + } + else + { + var _isCheck = (_part.Ischeck == null) ? false : _part.Ischeck; + barcode.Qlevel = _part.Qlevel; + barcode.QMark = (_isCheck == true) ? "" : "ȫ"; + barcode.ProjectId = _part.ProjectId; + } + var fullCode = GetFullCode_Small(barcode); + barcode.FullBarCode = fullCode; + list.Add(barcode); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = list; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Message = "!"; + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//ʵ֤쳣 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("{0}ֶΣ{1}Ϣ{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "ֶ֤ʧ" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//ͻ쳣 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateSmallBarcodeList", e.Message); + throw e; + } + return _ret; + } public static ResultObject> CreateBarcodeList(V_TB_ASN_DETAIL p_entity, int cnt = 1) { @@ -474,7 +733,19 @@ namespace CK.SCP.Controller } return _ret; } - + public static string GetFullCode_Small(TS_BARCODE_SMALL barcode) + { + var fullcode = string.Empty; + switch (ScpCache.Config.άʽ) + { + case "1": + fullcode = + GetFullCode(barcode.BarCode, barcode.Qty, barcode.VendId, barcode.VendBatch, barcode.PoBillNum, + barcode.PoBillLine, barcode.ProduceDate, barcode.BillNum); + break; + } + return fullcode; + } public static string GetFullCode(TS_BARCODE barcode) { var fullcode = string.Empty; @@ -533,8 +804,100 @@ namespace CK.SCP.Controller return null; } + public static TS_BARCODE_SMALL CreateSmallBarcode(V_TB_ASN_DETAIL p_entity) + { + var ret = CreateSmallBarcodeList(p_entity); + if (ret.State == ReturnStatus.Succeed) + { + return ret.Result[0]; + } + return null; + } + private static ResultObject GetSmallBarcodeRule(string partcode, string batch, int cnt = 1) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + var ruleBatch = batch.Substring(0, 4); + var barcodeRule = db.TS_BARCODE_RULE_SMALL.Find(partcode, ruleBatch); + if (barcodeRule == null) + { + barcodeRule = new TS_BARCODE_RULE_SMALL + { + PartCode = partcode, + RuleBatch = ruleBatch, + LastNumber = cnt, + State = 0 + }; + } + else + { + barcodeRule.LastNumber += cnt; + } + barcodeRule.LastBarCode = GetLastSmallBarCode(partcode, batch, barcodeRule.LastNumber); + barcodeRule.LastTime = ScpCache.GetServerTime(); + db.TS_BARCODE_RULE_SMALL.AddOrUpdate(p => new { p.PartCode, p.RuleBatch }, barcodeRule); + if (db.SaveChanges() != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = barcodeRule; + } + else + { + _ret.State = ReturnStatus.Failed; + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//ʵ֤쳣 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("{0}ֶΣ{1}Ϣ{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "ֶ֤ʧ" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//ͻ쳣 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", e.Message); + throw e; + } + return _ret; + } private static ResultObject GetBarcodeRule( string partcode, string batch, int cnt = 1) { ResultObject _ret = new ResultObject(); @@ -647,7 +1010,22 @@ namespace CK.SCP.Controller return barcode; } + private static string GetLastSmallBarCode(string partcode, string batch, int lastnum) + { + var barcode = string.Empty; + barcode += partcode + ScpCache.Config.ָ; + if (ScpCache.Config.Ӧ̼) + { + barcode += batch + ScpCache.Config.ָ; + } + else + { + barcode += batch + ScpCache.Config.ָ; + } + barcode += lastnum.ToString(ScpCache.Config.СװкŸʽ); + return barcode; + } } public class TS_BARCODE_S diff --git a/Controller/SCP_BILLCODE_CONTROLLER.cs b/Controller/SCP_BILLCODE_CONTROLLER.cs index 426bf64..dd31204 100644 --- a/Controller/SCP_BILLCODE_CONTROLLER.cs +++ b/Controller/SCP_BILLCODE_CONTROLLER.cs @@ -42,6 +42,17 @@ namespace CK.SCP.Controller return GetTablePK("G", "TB_PALLET", "PalletNum", "yyMMdd", 4); + } + /// + /// 生成托盘码(青岛) + /// + /// + /// + public static string MakePalletCode_QD(int num) + { + + return GetTablePK_QD("G", "TB_PALLETS", "PalletNum", "yyMMdd", 4,num); + } public static string MakeASKCode() { @@ -114,6 +125,33 @@ namespace CK.SCP.Controller } return _result; } + public static string GetTablePK_QD(string Ext, string TableName, string ColName, string Format, int len,int num) + { + var _result = string.Empty; + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + string time = Ext + DateTime.Now.ToString(Format); + string sql = "select max(right(" + ColName + "," + len.ToString() + ")+1) from " + TableName + " where " + ColName + " like '" + time + "%'"; + DbRawSqlQuery result = db.Database.SqlQuery(sql); + var obj = result.FirstOrDefault(); + if (obj == null) + { + _result = time + num.ToString().PadLeft(len, '0'); + } + else + { + _result = time + (result.FirstOrDefault()+num).ToString().PadLeft(len, '0'); + } + } + } + catch (Exception e) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BILLCODE_CONTROLLER), "GetTablePK", e.Message); + } + return _result; + } } diff --git a/Controller/SCP_EXCEL_CONTROLLER.cs b/Controller/SCP_EXCEL_CONTROLLER.cs index e5ea48d..cece739 100644 --- a/Controller/SCP_EXCEL_CONTROLLER.cs +++ b/Controller/SCP_EXCEL_CONTROLLER.cs @@ -204,9 +204,10 @@ namespace CK.SCP.Controller //_entity.价格 = itm.Price.ToString(); _entity.要货数量 = itm.AskQty.ToString(); _entity.说明 = string.IsNullOrEmpty(itm.Remark)?string.Empty:itm.Remark.ToString(); - _entity.预测一 = itm.OneMonth.ToString(); - _entity.预测二= itm.TwoMonth.ToString(); - _entity.预测三 = itm.ThreeMonth.ToString(); + _entity.到货日期 = itm.EndTime == null ? string.Empty : itm.EndTime.Value.ToString("yyyyMMdd"); + _entity.预测一 = itm.Extend1.ToString(); + _entity.预测二= itm.Extend2.ToString(); + _entity.预测三 = itm.Extend3.ToString(); _exportDetailList.Add(_entity); }); diff --git a/Controller/SCP_PALLET_CONTROLLER.cs b/Controller/SCP_PALLET_CONTROLLER.cs index da3321a..37ccd14 100644 --- a/Controller/SCP_PALLET_CONTROLLER.cs +++ b/Controller/SCP_PALLET_CONTROLLER.cs @@ -175,8 +175,82 @@ namespace CK.SCP.Controller } } + public static void Get_TB_PALLETS_List(TB_PALLETS p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.TB_PALLETS; + if (p_entity.UID != 0) + { + q = q.Where(p => p.UID == p_entity.UID); + } + if (!string.IsNullOrEmpty(p_entity.AsnBillNum)) + { + q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum)); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + if (!string.IsNullOrEmpty(p_entity.PartCode)) + { + q = q.Where(p => p.PartCode.Contains(p_entity.PartCode)); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = q; + p_action(_ret); + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", e.Message); + throw e; + } + } public ResultObject Save_V_TB_PALLET(List p_entitys) { ResultObject _ret = new ResultObject(); diff --git a/Controller/SCP_PLAN_MONTH_CONTROLLER.cs b/Controller/SCP_PLAN_MONTH_CONTROLLER.cs index c6a6948..43ed65d 100644 --- a/Controller/SCP_PLAN_MONTH_CONTROLLER.cs +++ b/Controller/SCP_PLAN_MONTH_CONTROLLER.cs @@ -21,7 +21,58 @@ namespace CK.SCP.Controller return db.TB_PlanMonth.SingleOrDefault(p => p.ID == id); } } + public static bool DeletePlanMonthById(TB_PlanMonth model) + { + bool _res=false; + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + db.TB_PlanMonth.Remove(model); + if (db.SaveChanges() != -1) + { + _res = true; + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + Utils.LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PLAN_MONTH_CONTROLLER), "DeletePlanMonthById", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PLAN_MONTH_CONTROLLER), "DeletePlanMonthById", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PLAN_MONTH_CONTROLLER), "DeletePlanMonthById", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PLAN_MONTH_CONTROLLER), "DeletePlanMonthById", e.Message); throw e; + } + return _res; + } public static bool UpdatePlanMonthById(TB_PlanMonth model) { try diff --git a/Controller/SCP_PO_CONTROLLER.cs b/Controller/SCP_PO_CONTROLLER.cs index 9e54c26..6a81dee 100644 --- a/Controller/SCP_PO_CONTROLLER.cs +++ b/Controller/SCP_PO_CONTROLLER.cs @@ -1165,10 +1165,10 @@ namespace CK.SCP.Controller IsDeleted = false, GUID = System.Guid.NewGuid(), }; - _venderpart.VendPartCode = p.零件号.ToUpper(); + _venderpart.VendPartCode = p.供应商零件号.ToUpper(); _venderpart.VendPackQty = decimal.Parse(p.标包数); - //_venderpart.MinPackQty = decimal.Parse(p.小包装数); - //_venderpart.PalletPackQty = decimal.Parse(p.托盘包装数); + _venderpart.MinPackQty = decimal.Parse(p.小包装数); + _venderpart.PalletPackQty = decimal.Parse(p.托盘包装数); _venderpart.PoUnit = p.单位; _venderpart.Remark = ""; _venderpart.UpdateTime = DateTime.Now; @@ -1925,7 +1925,7 @@ namespace CK.SCP.Controller } else { - + p_order_list = p_order_list.Where(p => int.Parse(p.数量) != 0).ToList(); var VenderList = p_order_list.Select(p => p.供应商编号).Distinct(); diff --git a/Controller/SCP_TS_BARCODE_CONTROLLER.cs b/Controller/SCP_TS_BARCODE_CONTROLLER.cs index f7b4094..5aaf3e7 100644 --- a/Controller/SCP_TS_BARCODE_CONTROLLER.cs +++ b/Controller/SCP_TS_BARCODE_CONTROLLER.cs @@ -381,6 +381,148 @@ namespace CK.SCP.Controller } return _ret; } + public static void Get_TS_BARCODE_Small_List(TS_BARCODE_SMALL p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.TS_BARCODE_SMALL; + if (p_entity.UIDList != null && p_entity.UIDList.Count > 0) + { + q = q.Where(p => p_entity.UIDList.Contains(p.UID)); + } + if (!string.IsNullOrEmpty(p_entity.BarCode)) + { + q = q.Where(p => p.BarCode.Contains(p_entity.BarCode)); + } + if (!string.IsNullOrEmpty(p_entity.FullBarCode)) + { + q = q.Where(p => p.FullBarCode.Contains(p_entity.FullBarCode)); + } + if (!string.IsNullOrEmpty(p_entity.PartCode)) + { + q = q.Where(p => p.PartCode.Contains(p_entity.PartCode)); + } + if (!string.IsNullOrEmpty(p_entity.VendPartCode)) + { + q = q.Where(p => p.VendPartCode.Contains(p_entity.VendPartCode)); + } + if (!string.IsNullOrEmpty(p_entity.Batch)) + { + q = q.Where(p => p.Batch.Contains(p_entity.Batch)); + } + if (p_entity.ManageType != 0) + { + q = q.Where(p => p.ManageType == p_entity.ManageType); + } + if (!string.IsNullOrEmpty(p_entity.SerialNum)) + { + q = q.Where(p => p.SerialNum.Contains(p_entity.SerialNum)); + } + if (p_entity.Qty != 0) + { + q = q.Where(p => p.Qty == p_entity.Qty); + } + if (p_entity.BarCodeType != 0) + { + q = q.Where(p => p.BarCodeType == p_entity.BarCodeType); + } + if (!string.IsNullOrEmpty(p_entity.BillNum)) + { + q = q.Where(p => p.BillNum.Contains(p_entity.BillNum)); + } + if (p_entity.PoBillLine != 0) + { + q = q.Where(p => p.PoBillLine == p_entity.PoBillLine); + } + if (!string.IsNullOrEmpty(p_entity.VendId)) + { + q = q.Where(p => p.VendId.Contains(p_entity.VendId)); + } + if (!string.IsNullOrEmpty(p_entity.VendBatch)) + { + q = q.Where(p => p.VendBatch.Contains(p_entity.VendBatch)); + } + if (p_entity.SmallPackQty != 0) + { + q = q.Where(p => p.SmallPackQty == p_entity.SmallPackQty); + } + if (!string.IsNullOrEmpty(p_entity.CreateOper)) + { + q = q.Where(p => p.CreateOper.Contains(p_entity.CreateOper)); + } + if (p_entity.State != 0) + { + q = q.Where(p => p.State == p_entity.State); + } + if (!string.IsNullOrEmpty(p_entity.Remark)) + { + q = q.Where(p => p.Remark.Contains(p_entity.Remark)); + } + if (!string.IsNullOrEmpty(p_entity.PoUnit)) + { + q = q.Where(p => p.PoUnit.Contains(p_entity.PoUnit)); + } + if (!string.IsNullOrEmpty(p_entity.LocUnit)) + { + q = q.Where(p => p.LocUnit.Contains(p_entity.LocUnit)); + } + if (!string.IsNullOrEmpty(p_entity.PartName)) + { + q = q.Where(p => p.PartName.Contains(p_entity.PartName)); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = q; + p_action(_ret); + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TS_BARCODE_CONTROLLER), "Get_TS_BARCODE_Small_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TS_BARCODE_CONTROLLER), "Get_TS_BARCODE_Small_List", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TS_BARCODE_CONTROLLER), "Get_TS_BARCODE_Small_List", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_TS_BARCODE_CONTROLLER), "Get_TS_BARCODE_Small_List", e.Message); + throw e; + } + } public ResultObject Del_TS_BARCODE(List p_entitys) { diff --git a/Models/CK.SCP.Models.csproj b/Models/CK.SCP.Models.csproj index ab132b0..aba732a 100644 --- a/Models/CK.SCP.Models.csproj +++ b/Models/CK.SCP.Models.csproj @@ -339,6 +339,7 @@ + @@ -370,6 +371,8 @@ + + @@ -415,6 +418,7 @@ + diff --git a/Models/Enums/SCP_ENUM.cs.cs b/Models/Enums/SCP_ENUM.cs.cs index e91d19a..b6f84d8 100644 --- a/Models/Enums/SCP_ENUM.cs.cs +++ b/Models/Enums/SCP_ENUM.cs.cs @@ -101,6 +101,8 @@ namespace CK.SCP.Models.Enums NoConfirm = 7, [Description("退回")] Back = 8, + [Description("关闭")] + Close = -2, } @@ -220,6 +222,8 @@ namespace CK.SCP.Models.Enums ASN = 1, [Description("发货单")] BAR_CODE =2, + [Description("托盘")] + Pallet_CODE = 3, } public enum PalletType diff --git a/Models/ScpCache.cs b/Models/ScpCache.cs index f79043f..54bdce4 100644 --- a/Models/ScpCache.cs +++ b/Models/ScpCache.cs @@ -314,6 +314,6 @@ namespace CK.SCP.Models public string 二维码格式 { get; set; } = "1"; public string 条码序列号格式 { get; set; } = "000000"; - + public string 小包装条码序列号格式 { get; set; } = "600000"; } } \ No newline at end of file diff --git a/Models/ScpEntities.cs b/Models/ScpEntities.cs index 88c9b81..a37a887 100644 --- a/Models/ScpEntities.cs +++ b/Models/ScpEntities.cs @@ -52,6 +52,7 @@ namespace CK.SCP.Models public virtual DbSet TL_BILL { get; set; } public virtual DbSet TL_OPER { get; set; } public virtual DbSet TS_BARCODE { get; set; } + public virtual DbSet TS_BARCODE_SMALL { get; set; } public virtual DbSet TS_STOCK { get; set; } public virtual DbSet TS_UNI_API { get; set; } public virtual DbSet TS_UNI_API_HIS { get; set; } @@ -93,6 +94,7 @@ namespace CK.SCP.Models public virtual DbSet V_TB_REJECT { get; set; } public virtual DbSet V_TB_REJECT_DETAIL { get; set; } public virtual DbSet TS_BARCODE_RULE { get; set; } + public virtual DbSet TS_BARCODE_RULE_SMALL { get; set; } public virtual DbSet V_TB_INVOICE_DETAIL { get; set; } public virtual DbSet V_TB_INVOICE { get; set; } public virtual DbSet V_TB_INVOICE_DETAIL_RED { get; set; } @@ -107,6 +109,8 @@ namespace CK.SCP.Models public virtual DbSet V_TB_PALLET { get; set; } public virtual DbSet TB_PALLET_DETAIL { get; set; } public virtual DbSet TB_PALLET { get; set; } + public virtual DbSet TB_PALLETS { get; set; } + public virtual DbSet V_TB_PALLETS { get; set; } public virtual DbSet TB_QUALITY { get; set; } public virtual DbSet V_TB_QUALITY { get; set; } public virtual DbSet V_TB_RETURN { get; set; } diff --git a/Models/ScpEntity/ExcelExportEnttity/SCP_ASK_DETAIL_EXPORT.cs b/Models/ScpEntity/ExcelExportEnttity/SCP_ASK_DETAIL_EXPORT.cs index db2b598..fb249f8 100644 --- a/Models/ScpEntity/ExcelExportEnttity/SCP_ASK_DETAIL_EXPORT.cs +++ b/Models/ScpEntity/ExcelExportEnttity/SCP_ASK_DETAIL_EXPORT.cs @@ -19,7 +19,7 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity //public string 价格 {get;set;} //"Price" public string 要货数量 {get;set;} //"AskQty" public string 说明 { get; set; } //"ReMark" - + public string 到货日期 { get; set; } public string 预测一 { get; set; } //"OneMonth" public string 预测二 { get; set; } //"TwoMonth" public string 预测三 { get; set; } //"ThreeMonth" diff --git a/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs b/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs index d4e44d3..f5d8bb3 100644 --- a/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs +++ b/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs @@ -106,23 +106,6 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity public string 要求到货日期 { get; set; } public string 备注 { get; set; } public string 币种 { set; get; } - public string 订单类型 { get; set; } - public string 税率 { get; set; } - public string 加工单号 { get; set; } - public string 工序 { get; set; } - public string 库位 { get; set; } - public string 固定天数 { get; set; } - public string 日程天数 { get; set; } - public string 日程周数 { get; set; } - public string 日程月数 { get; set; } - public string 供应商零件 { get; set; } - public string 发货样式 { get; set; } - public string 发货时间样式 { get; set; } - public string 运输周期 { get; set; } - public string 零件开始时间 { get; set; } - public string 零件截至日期 { get; set; } - public string 订单开始时间 { get; set; } - public string 订单截至日期 { get; set; } } } diff --git a/Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs b/Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs index f1fe2b1..ea6b803 100644 --- a/Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs +++ b/Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs @@ -11,6 +11,7 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity public string 供应商代码{ get; set; } public string 零件号 { get; set; } + public string 供应商零件号 { get; set; } public string 零件名称 { get; set; } public string 标包数 { get; set; } public string 单位 { get; set; } diff --git a/Models/ScpEntity/TA_VENDER.cs b/Models/ScpEntity/TA_VENDER.cs index 1cc7d27..6091c8e 100644 --- a/Models/ScpEntity/TA_VENDER.cs +++ b/Models/ScpEntity/TA_VENDER.cs @@ -19,7 +19,7 @@ namespace CK.SCP.Models.ScpEntity public string VendName { get; set; } [Required] - [StringLength(2)] + [StringLength(50)] public string VendAbbCode { get; set; } [StringLength(50)] diff --git a/Models/ScpEntity/TA_VEND_PART.cs b/Models/ScpEntity/TA_VEND_PART.cs index 131cc9f..341b5e0 100644 --- a/Models/ScpEntity/TA_VEND_PART.cs +++ b/Models/ScpEntity/TA_VEND_PART.cs @@ -41,9 +41,9 @@ namespace CK.SCP.Models.ScpEntity public int? TransportationTime { get; set; } - //public decimal? MinPackQty { get; set; } + public decimal? MinPackQty { get; set; } - //public decimal? PalletPackQty { get; set; } + public decimal? PalletPackQty { get; set; } [NotMapped] [DisplayName("Ӧ")] diff --git a/Models/ScpEntity/TB_PALLETS.cs b/Models/ScpEntity/TB_PALLETS.cs new file mode 100644 index 0000000..fe9a351 --- /dev/null +++ b/Models/ScpEntity/TB_PALLETS.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CK.SCP.Models.ScpEntity +{ + public partial class TB_PALLETS + { + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key] + public long UID { get; set; } + [StringLength(50)] + public string AsnBillNum { get; set; } + public string PalletNum { get; set; } + public string PartCode { get; set; } + public string Batch { get; set; } + public string VendId { get; set; } + public int Box { get; set; } + public decimal Qty { get; set; } + + } +} diff --git a/Models/ScpEntity/TS_BARCODE_RULE_SMALL.cs b/Models/ScpEntity/TS_BARCODE_RULE_SMALL.cs new file mode 100644 index 0000000..8d4fb73 --- /dev/null +++ b/Models/ScpEntity/TS_BARCODE_RULE_SMALL.cs @@ -0,0 +1,32 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace CK.SCP.Models.ScpEntity +{ + public partial class TS_BARCODE_RULE_SMALL + { + [DatabaseGenerated(DatabaseGeneratedOption.Computed)] + public int UID { get; set; } + + [Key] + [Column(Order = 0)] + [StringLength(50)] + public string PartCode { get; set; } + + [Key] + [Column(Order = 1)] + [StringLength(50)] + public string RuleBatch { get; set; } + + public int LastNumber { get; set; } + + [Required(AllowEmptyStrings = true)] + [StringLength(500)] + public string LastBarCode { get; set; } + + public DateTime LastTime { get; set; } + + public int State { get; set; } + } +} diff --git a/Models/ScpEntity/TS_BARCODE_SMALL.cs b/Models/ScpEntity/TS_BARCODE_SMALL.cs new file mode 100644 index 0000000..914a98d --- /dev/null +++ b/Models/ScpEntity/TS_BARCODE_SMALL.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace CK.SCP.Models.ScpEntity +{ + public partial class TS_BARCODE_SMALL + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public long UID { get; set; } + + + [StringLength(50)] + public string BarCode { get; set; } + + [Required] + [StringLength(500)] + public string FullBarCode { get; set; } + + [Required] + [StringLength(50)] + public string PartCode { get; set; } + + [StringLength(50)] + public string VendPartCode { get; set; } + + [Required] + [StringLength(50)] + public string Batch { get; set; } + + [Column(TypeName = "datetime2")] + public DateTime ProduceDate { get; set; } + + public int ManageType { get; set; } + + [Required] + [StringLength(50)] + public string SerialNum { get; set; } + + [Column(TypeName = "money")] + public decimal Qty { get; set; } + + public int BarCodeType { get; set; } + + [Required] + [StringLength(50)] + public string BillNum { get; set; } + + public int PoBillLine { get; set; } + + [StringLength(50)] + public string VendId { get; set; } + + [StringLength(50)] + public string VendBatch { get; set; } + + [Column(TypeName = "money")] + public decimal SmallPackQty { get; set; } + + [Required] + [StringLength(50)] + public string CreateOper { get; set; } + + public DateTime CreateTime { get; set; } + + public int State { get; set; } + + [StringLength(500)] + public string Remark { get; set; } + + public string PoUnit { get; set; } + public string LocUnit { get; set; } + + + public string Site { get; set; } + public string Qlevel { get; set; } + public string QMark { get; set; } + public string ProjectId { get; set; } + + public string PoBillNum { get; set; } + + + + [DisplayName("供应商名称")] + public string VendName => ScpCache.GetVendName(VendId, Site); + + + [DisplayName("零件名称")] + + + public string PartDesc => ScpCache.GetPartDesc1(PartCode, Site); + + [DisplayName("零件名称")] + public string PartName => ScpCache.GetPartDesc1(PartCode, Site); + [NotMapped] + public List UIDList { get; set; } + } +} diff --git a/Models/ScpEntity/V_ASN_PRINT.cs b/Models/ScpEntity/V_ASN_PRINT.cs index d1e6b9b..2d54c3f 100644 --- a/Models/ScpEntity/V_ASN_PRINT.cs +++ b/Models/ScpEntity/V_ASN_PRINT.cs @@ -22,8 +22,8 @@ namespace CK.SCP.Models.ScpEntity public string MaterialPlanner{get;set;} public string CAAIPhone{get;set;} public string CAAIFax { get; set; } + public string Total { get; set; } - } public class V_ASN_PRINT_DETAIL diff --git a/Models/ScpEntity/V_TA_VEND_PART.cs b/Models/ScpEntity/V_TA_VEND_PART.cs index 97a8190..56e93dc 100644 --- a/Models/ScpEntity/V_TA_VEND_PART.cs +++ b/Models/ScpEntity/V_TA_VEND_PART.cs @@ -23,6 +23,7 @@ namespace CK.SCP.Models.ScpEntity public long UID { get; set; } public string VendId { get; set; } public string PartCode { get; set; } + public string VendPartCode { get; set; } public decimal VendPackQty { get; set; } public string PoUnit { get; set; } public string Site { get; set; } diff --git a/Models/ScpEntity/V_TB_ASK_DETAIL.cs b/Models/ScpEntity/V_TB_ASK_DETAIL.cs index 2700800..ff16455 100644 --- a/Models/ScpEntity/V_TB_ASK_DETAIL.cs +++ b/Models/ScpEntity/V_TB_ASK_DETAIL.cs @@ -84,9 +84,6 @@ namespace CK.SCP.Models.ScpEntity public decimal? ReduceQty { get; set; } - public decimal OneMonth { get; set; } - public decimal TwoMonth { get; set; } - public decimal ThreeMonth { get; set; } public int ValidityDays { get; set; } diff --git a/Models/ScpEntity/V_TB_ASN_DETAIL.cs b/Models/ScpEntity/V_TB_ASN_DETAIL.cs index 972bcb8..19b95b1 100644 --- a/Models/ScpEntity/V_TB_ASN_DETAIL.cs +++ b/Models/ScpEntity/V_TB_ASN_DETAIL.cs @@ -94,6 +94,6 @@ namespace CK.SCP.Models.ScpEntity public string Extend2 { get; set; } public string Extend3 { get; set; } - public string SubSite { get; set; } + public string SubSite { get; set; } } } diff --git a/Models/ScpEntity/V_TB_PALLETS.cs b/Models/ScpEntity/V_TB_PALLETS.cs new file mode 100644 index 0000000..f01f07d --- /dev/null +++ b/Models/ScpEntity/V_TB_PALLETS.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace CK.SCP.Models.ScpEntity +{ + public partial class V_TB_PALLETS + { + + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key] + public long UID { get; set; } + [StringLength(50)] + public string AsnBillNum { get; set; } + public string PalletNum { get; set; } + public string PartCode { get; set; } + public string PartName { get; set; } + public string Batch { get; set; } + public string VendId { get; set; } + public int Box { get; set; } + public decimal Qty { get; set; } + } +} diff --git a/SCP/Common/ReportHelper.cs b/SCP/Common/ReportHelper.cs index f356330..d1d75fb 100644 --- a/SCP/Common/ReportHelper.cs +++ b/SCP/Common/ReportHelper.cs @@ -22,6 +22,9 @@ namespace SCP.Common ASN = 102, ARRIVE = 103, CUSTOM_PAGE = 104, + ASN_PALLET =107, + PALLET=105, + SmallBARCODE = 106, } public class TextProvider { @@ -60,8 +63,30 @@ namespace SCP.Common case (int)PrintType.CUSTOM_PAGE: ds =GET_CUSTOM_PAGE(p_request); break; - - + case (int)PrintType.ASN_PALLET: + ds = GET_ASN_PALLET(p_request); + break; + case (int)PrintType.PALLET: + ds = GET_TB_PALLETS(p_request); + break; + case (int)PrintType.SmallBARCODE: + ds = GET_TS_BAR_Small(p_request); + break; + } + return ds; + } + /// + /// 获取发货单(带托盘明细的发货单) + /// + /// + /// + private static DataSet GET_ASN_PALLET(HttpRequest p_request) + { + DataSet ds = new DataSet(); + if (!string.IsNullOrEmpty(p_request["AsnBillNum"])) + { + var AskBillNum = p_request["AsnBillNum"].ToString(); + ds = SCP_ASN_CONTROLLER.ASN_PALLET_REPORT(AskBillNum); } return ds; } @@ -74,6 +99,33 @@ namespace SCP.Common ds=SCP_ASN_CONTROLLER.ASN_REPORT(AskBillNum); } return ds; + } + /// + /// 获取托盘 + /// + /// + /// + private static DataSet GET_TB_PALLETS(HttpRequest p_request) + { + DataSet ds = new DataSet(); + TB_PALLETS _pallet = new TB_PALLETS(); + if (!string.IsNullOrEmpty(p_request["AsnBillNum"])) + { + _pallet.AsnBillNum = p_request["AsnBillNum"].ToString(); + } + if (!string.IsNullOrEmpty(_pallet.AsnBillNum)) + { + SCP_PALLET_CONTROLLER.Get_TB_PALLETS_List(_pallet, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + var _ls = ret.Result.DistinctBy(t=>t.PalletNum); + var dt = ConvertHelper.ToDataTable(_ls.ToList()); + ds.Tables.Add(dt); + } + }); + } + return ds; } private static DataSet GET_TS_BAR(HttpRequest p_request) { @@ -112,7 +164,40 @@ namespace SCP.Common return ds; } + private static DataSet GET_TS_BAR_Small(HttpRequest p_request) + { + DataSet ds = new DataSet(); + TS_BARCODE_SMALL _bar = new TS_BARCODE_SMALL(); + if (!string.IsNullOrEmpty(p_request["AsnBillNum"])) + { + _bar.BillNum = p_request["AsnBillNum"].ToString(); + } + if (!string.IsNullOrEmpty(p_request["Barcode"])) + { + var _ls = p_request["Barcode"].ToString().Split('_').ToList(); + _bar.UIDList = new List(); + _ls.ForEach(p => + { + if (!string.IsNullOrEmpty(p)) + { + _bar.UIDList.Add(long.Parse(p)); + } + }); + } + if (!string.IsNullOrEmpty(_bar.BillNum) || _bar.UIDList != null) + { + SCP_TS_BARCODE_CONTROLLER.Get_TS_BARCODE_Small_List(_bar, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + var dt = ConvertHelper.ToDataTable(ret.Result.ToList()); + ds.Tables.Add(dt); + } + }); + } + return ds; + } private static DataSet GET_TS_BAR_CUSTOM(HttpRequest p_request) { diff --git a/SCP/SCP.csproj b/SCP/SCP.csproj index 5537eb2..b2a17a1 100644 --- a/SCP/SCP.csproj +++ b/SCP/SCP.csproj @@ -2913,6 +2913,8 @@ + + @@ -2931,6 +2933,7 @@ + @@ -4577,9 +4580,9 @@ + - - + Designer @@ -5103,6 +5106,20 @@ ASN_STATE.aspx + + PlanMonth.aspx + ASPXCodeBehind + + + PlanMonth.aspx + + + PlanMonthEdit.aspx + ASPXCodeBehind + + + PlanMonthEdit.aspx + SCP_ASK.aspx ASPXCodeBehind @@ -5228,6 +5245,13 @@ SCP_RECVICE_REPORT.aspx + + PlanMonth.aspx + ASPXCodeBehind + + + PlanMonth.aspx + SCP_FORECAST.aspx ASPXCodeBehind @@ -6102,6 +6126,13 @@ SCP_ASK_DETAIL.aspx + + SCP_ASN.aspx + ASPXCodeBehind + + + SCP_ASN.aspx + SCP_ASN_CREATE.aspx ASPXCodeBehind @@ -6109,19 +6140,12 @@ SCP_ASN_CREATE.aspx - - SCP_SHIP_DETAIL_BARCODE.aspx - ASPXCodeBehind - - - SCP_SHIP_DETAIL_BARCODE.aspx - - - SCP_TS_BARCODE.aspx + + SCP_ASN_DETAIL.aspx ASPXCodeBehind - - SCP_TS_BARCODE.aspx + + SCP_ASN_DETAIL.aspx diff --git a/SCP/Views/BasicData/SCP_TA_VEND_PART.aspx b/SCP/Views/BasicData/SCP_TA_VEND_PART.aspx index 7d22845..c7871bf 100644 --- a/SCP/Views/BasicData/SCP_TA_VEND_PART.aspx +++ b/SCP/Views/BasicData/SCP_TA_VEND_PART.aspx @@ -61,6 +61,7 @@ + diff --git a/SCP/Views/PlanData/PlanMonth.aspx b/SCP/Views/PlanData/PlanMonth.aspx new file mode 100644 index 0000000..2ff891d --- /dev/null +++ b/SCP/Views/PlanData/PlanMonth.aspx @@ -0,0 +1,110 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PlanMonth.aspx.cs" Inherits="SCP.PlanData.PlanMonth" %> + + + + + + + + + +
+ + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +