From d0463e8535e0e51abf1f982000a11e23d01970ff Mon Sep 17 00:00:00 2001
From: lvzb <35200379@qq.com>
Date: Thu, 4 Feb 2021 08:40:50 +0800
Subject: [PATCH] =?UTF-8?q?TB=5FPRICE=20=20=20=20=20=E5=8E=BB=E6=8E=89=20S?=
=?UTF-8?q?tate/VendAmt=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95=E5=AF=BC=E5=85=A5?=
=?UTF-8?q?=E5=B9=B6=E4=B8=94=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BA=E8=A6=81?=
=?UTF-8?q?=E8=B4=A7=E7=9C=8B=E6=9D=BF=E4=BC=A0=E6=8E=A5=E5=8F=A3=E5=85=B1?=
=?UTF-8?q?=E5=91=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Controller/SCP_BILLCODE_CONTROLLER.cs | 67 ++
Controller/SCP_DC_UNI_CONTROLLER.cs | 382 ++++++++++-
Controller/SCP_PO_CONTROLLER.cs | 614 ++++++++++++++++++
Models/AppBoxEntity/User.cs | 2 +-
.../SCP_PO_DETAIL_EXPORT.cs | 18 +-
Models/ScpEntity/TB_PRICE.cs | 4 +-
SCP/Business/PageBase.cs | 2 +-
SCP/Properties/AssemblyInfo.cs | 4 +-
SCP/VersionUpdateInfo.txt | 6 +
SCP/Views/PlanData/SCP_PO.aspx | 8 +-
SCP/Views/PlanData/SCP_PO.aspx.cs | 58 ++
SCP/Views/PlanData/SCP_PO.aspx.designer.cs | 18 +
SCP/Views/PlanData/SCP_PO_EXTEND.aspx | 6 +
SCP/Views/PlanData/SCP_PO_EXTEND.aspx.cs | 61 +-
.../PlanData/SCP_PO_EXTEND.aspx.designer.cs | 27 +
15 files changed, 1254 insertions(+), 23 deletions(-)
diff --git a/Controller/SCP_BILLCODE_CONTROLLER.cs b/Controller/SCP_BILLCODE_CONTROLLER.cs
index bfe208d..916e5ab 100644
--- a/Controller/SCP_BILLCODE_CONTROLLER.cs
+++ b/Controller/SCP_BILLCODE_CONTROLLER.cs
@@ -54,6 +54,19 @@ namespace CK.SCP.Controller
return GetTablePK_QD("G", "TB_PALLETS", "PalletNum", "yyMMdd", 4,num);
}
+ ///
+ /// 生成订单编号
+ ///
+ ///
+ ///
+ public static string MakePoNum(int num = 1)
+ {
+ return GetTablePO("P", "TB_PO", "PoBillNum", 7, num);
+ }
+ public static string MakeASKCodeByNum(int num)
+ {
+ return GetTablePKByNum("K", "TB_ASK", "AskBillNum", "yyMMdd", 4, num);
+ }
public static string MakeASKCode()
{
@@ -107,6 +120,60 @@ namespace CK.SCP.Controller
return GetTablePK(p_Header, p_TableName, p_ColumnName, "yyMMdd",4);
}
+ public static string GetTablePO(string Ext, string TableName, string ColName, int len, int num)
+ {
+ var _result = string.Empty;
+ try
+ {
+ using (ScpEntities db = EntitiesFactory.CreateScpInstance())
+ {
+
+ string sql = "select max(right(" + ColName + "," + len.ToString() + ")+" + num + ") from " + TableName + " where " + ColName + " like '%P[0-9]%' ";
+ DbRawSqlQuery result = db.Database.SqlQuery(sql);
+ var obj = result.FirstOrDefault();
+ if (obj == null)
+ {
+ _result = Ext + num.ToString().PadLeft(len, '0');
+ }
+ else
+ {
+ _result = Ext + result.FirstOrDefault().ToString().PadLeft(len, '0');
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BILLCODE_CONTROLLER), "GetTablePK", e.Message);
+ }
+ return _result;
+ }
+ public static string GetTablePKByNum(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() + ")+" + num + ") 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().ToString().PadLeft(len, '0');
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BILLCODE_CONTROLLER), "GetTablePK", e.Message);
+ }
+ return _result;
+ }
public static string GetTablePK(string Ext, string TableName, string ColName, string Format, int len)
{
var _result = string.Empty;
diff --git a/Controller/SCP_DC_UNI_CONTROLLER.cs b/Controller/SCP_DC_UNI_CONTROLLER.cs
index 57c3e16..160fa00 100644
--- a/Controller/SCP_DC_UNI_CONTROLLER.cs
+++ b/Controller/SCP_DC_UNI_CONTROLLER.cs
@@ -1620,7 +1620,7 @@ namespace CK.SCP.Controller
_supplier.Site = supplier.Domain;//域
_supplier.Tax = Convert.ToDecimal(supplier.TaxClass/100);//税率
- _supplier.Remark = supplier.TaskID.ToString();//任务ID
+ _supplier.Remark = supplier.TaskID.ToString();//任务ID
var vendname = string.Format("{0}@{1}",_supplier.VendId.ToUpper(), _supplier.Site.ToUpper());
var _first = authdb.Users.Where(p => p.Name == vendname).FirstOrDefault();
@@ -1897,12 +1897,368 @@ namespace CK.SCP.Controller
return _ret;
}
-
+ public static ResultObject WritePo(List p_order_list, string site, string p_creator, DateTime p_time, BillModType p_modtype, string subsite, string p_chineseName, string p_buyerPhone)
+ {
+ ResultObject _ret = new ResultObject();
+ using (var scope =
+ new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
+ {
+ IsolationLevel = System.Transactions.IsolationLevel.Serializable,
+ Timeout = new TimeSpan(0, 20, 0)
+ }))
+ {
+ try
+ {
+ ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
+ ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
+ var OrderList = p_order_list.GroupBy(p => p.订单编号).ToList();
+ string _polist = "";
+ int _num = 1;
+ OrderList.ForEach((p) =>
+ {
+ Guid taskid = Guid.NewGuid();
+ var list = p.ToList();
+ if (list.Count > 0)
+ {
+ #region 日程单
+ if (p_modtype == BillModType.Contract)
+ {
+ var _entity = list.FirstOrDefault();
+ var _po = scpdb.TB_PO.SingleOrDefault(t => t.PoBillNum == _entity.订单编号/* && t.State == state*/ && t.Site == site && t.SubSite == subsite && t.VendId == _entity.供应商编号.ToUpper());
+ if (_po == null)
+ {
+ _po = new TB_PO { GUID = Guid.NewGuid(), PoBillNum = _entity.订单编号.ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite, VendId = _entity.供应商编号.Trim().ToUpper() };
+ }
+ _po.ErpBillNum = _entity.订单编号.Trim().ToUpper(); ;
+ _po.ModType = (int)p_modtype;
+ _po.Contacter = p_chineseName;// _entity.联系人;
+ _po.Buyer = p_chineseName;// _entity.联系人;
+ _po.Site = site.Trim().ToUpper();
+ _po.BuyerPhone = p_buyerPhone;
+ _po.Remark = _entity.备注;
+ _po.IsDeleted = false;
+ _po.CreateTime = DateTime.Now;
+ _po.CreateUser = p_creator;
+ _po.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(_entity.要求到货日期);
+ scpdb.TB_PO.AddOrUpdate(_po);
+ TED_PO_MSTR _po_mstr = new TED_PO_MSTR();
+ _po_mstr.GUID = Guid.NewGuid();
+ _po_mstr.PurchaseOrder = _entity.订单编号.Trim().ToUpper();
+ _po_mstr.Supplier = _entity.供应商编号.Trim().ToUpper();
+ _po_mstr.Contact = p_chineseName;// _entity.联系人;
+ _po_mstr.ShipTo = subsite.Trim().ToUpper();//发往
+ _po_mstr.OrderDate = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po_mstr.DueDate = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now : DateTime.Parse(_entity.要求到货日期);
+ _po_mstr.StartDate = string.IsNullOrEmpty(_entity.订单开始时间) ? DateTime.Now : DateTime.Parse(_entity.订单开始时间);//订单日期
+ _po_mstr.EndDate = string.IsNullOrEmpty(_entity.订单截至日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(_entity.订单截至日期);
+ _po_mstr.MadeIn = "";
+ _po_mstr.Confirm = true;
+ _po_mstr.Buyer = p_chineseName;//_entity.采购员;
+ _po_mstr.BuyerPhone = p_buyerPhone;// _entity.采购员电话;
+ _po_mstr.Status = (int)PoState.Open;
+ _po_mstr.ScheduledOrder = true;
+ _po_mstr.CreateUser = p_creator;
+ _po_mstr.CreateTime = p_time;
+ _po_mstr.Remark = _entity.备注; ;
+ _po_mstr.TaskID = taskid;
+ _po_mstr.Domain = site.Trim().ToUpper();
+ _po_mstr.ModeType = ((int)p_modtype).ToString();
+ _po_mstr.Site = subsite.Trim().ToUpper();
+ _po_mstr.DataID = Guid.NewGuid();
+ _po_mstr.Pricelist = _entity.供应商编号.ToUpper().Trim() + subsite.Trim().Substring(1, 1) + subsite.Substring(3, 1).Trim();
+ _po_mstr.Taxclass = _entity.税率;
+ _po_mstr.CommandType = "A";
+ db.TED_PO_MSTR.Add(_po_mstr);
+ list.ForEach((itm) =>
+ {
+ int _poline = Int32.Parse(itm.行号);
+ var _PO_Detail = scpdb.TB_PO_DETAIL.FirstOrDefault(t => t.PartCode == itm.零件号 && t.PoLine == _poline && t.PoBillNum == itm.订单编号 /*&& t.State == state*/ && t.Site == site && t.SubSite == subsite);
+ TED_PO_DET _PO_Detail_Det = new TED_PO_DET();
+ _PO_Detail_Det.GUID = Guid.NewGuid();
+ _PO_Detail_Det.PurchaseOrder = itm.订单编号.Trim().ToUpper();
+ _PO_Detail_Det.Line = Int32.Parse(itm.行号);
+ _PO_Detail_Det.Currency = "CNY";
+ _PO_Detail_Det.PoType = itm.订单类型;
+ _PO_Detail_Det.PartCode = itm.零件号.Trim().ToUpper();
+ _PO_Detail_Det.Qty = decimal.Parse(itm.数量);
+ _PO_Detail_Det.QtyOpen = 0;
+ _PO_Detail_Det.PackQty = 1;
+ _PO_Detail_Det.Currency = itm.币种;
+ _PO_Detail_Det.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ var _part = scpdb.TA_PART.FirstOrDefault(part => part.PartCode == itm.零件号.Trim().ToUpper());
+ if (_part == null)
+ {
+ _PO_Detail_Det.PoUm = itm.单位;
+ _PO_Detail_Det.LocUm = itm.单位;
+ }
+ else
+ {
+ _PO_Detail_Det.PoUm = _part.Unit;
+ _PO_Detail_Det.LocUm = _part.Unit;
+ }
+ _PO_Detail_Det.Conv = 1;
+ _PO_Detail_Det.DueDate = string.IsNullOrEmpty(itm.要求到货日期) ? DateTime.Now : DateTime.Parse(itm.要求到货日期);
+ _PO_Detail_Det.Status = (int)PoState.Open;
+ _PO_Detail_Det.CreateTime = DateTime.Parse(itm.订单创建时间);
+ _PO_Detail_Det.StartDate = string.IsNullOrEmpty(itm.零件开始时间) ? p_time : DateTime.Parse(itm.零件开始时间);
+ _PO_Detail_Det.EndDate = string.IsNullOrEmpty(itm.零件截至日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(itm.零件截至日期);
+ _PO_Detail_Det.CreateUser = p_creator;
+ _PO_Detail_Det.TaskID = taskid;
+ if (_PO_Detail != null)
+ {
+ _PO_Detail_Det.CommandType = "U";
+ }
+ else
+ {
+ _PO_Detail = new TB_PO_DETAIL { GUID = Guid.NewGuid(), PartCode = itm.零件号.Trim().ToUpper(), PoLine = _poline, PoBillNum = itm.订单编号.Trim().ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite };
+ _PO_Detail_Det.CommandType = "A";
+ }
+ _PO_Detail_Det.DataID = Guid.NewGuid();
+ _PO_Detail_Det.Domain = site.Trim().ToUpper();
+ _PO_Detail_Det.Site = subsite.Trim().ToUpper();
+ _PO_Detail_Det.Workorderlot = itm.加工单号;
+ _PO_Detail_Det.PoType = itm.订单类型;
+ _PO_Detail_Det.Operation = string.IsNullOrEmpty(itm.工序) ? 0 : int.Parse(itm.工序);
+ _PO_Detail_Det.Location = itm.库位;
+ _PO_Detail_Det.Firmdays = string.IsNullOrEmpty(itm.固定天数) ? 7 : int.Parse(itm.固定天数);
+ _PO_Detail_Det.Scheduledays = string.IsNullOrEmpty(itm.日程天数) ? 7 : int.Parse(itm.日程天数);
+ _PO_Detail_Det.Scheduleweeks = string.IsNullOrEmpty(itm.日程周数) ? 2 : int.Parse(itm.日程周数);
+ _PO_Detail_Det.Schedulemonth = string.IsNullOrEmpty(itm.日程月数) ? 1 : int.Parse(itm.日程月数);
+ _PO_Detail_Det.Supplieritem = itm.供应商零件;
+ _PO_Detail_Det.Dliverypatterncode = itm.发货样式;
+ _PO_Detail_Det.Deliverytimecode = itm.发货时间样式;
+ _PO_Detail_Det.Transportdays = string.IsNullOrEmpty(itm.运输周期) ? 0 : int.Parse(itm.运输周期);
+ _PO_Detail_Det.Pricelist = _entity.供应商编号.Trim().ToUpper() + subsite.Substring(1, 1) + subsite.Substring(3, 1);
+ db.TED_POD_DET.Add(_PO_Detail_Det);
+ _PO_Detail.Currency = "CNY";
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.CreateTime = DateTime.Now;
+ _PO_Detail.CreateUser = p_creator;
+ _PO_Detail.BeginTime = string.IsNullOrEmpty(itm.订单创建时间) ? DateTime.Now : DateTime.Parse(itm.订单创建时间);
+ _PO_Detail.EndTime = string.IsNullOrEmpty(itm.要求到货日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(itm.要求到货日期);
+ _PO_Detail.PlanQty = decimal.Parse(itm.数量);
+ _PO_Detail.IsDeleted = false;
+ _PO_Detail.LocUnit = itm.单位;
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.UnConv = 1;
+ _PO_Detail.Remark = itm.备注;
+ _PO_Detail.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ scpdb.TB_PO_DETAIL.AddOrUpdate(_PO_Detail);
+ });
+ _polist = _polist + _po.PoBillNum + ",";
+ }
+ #endregion
+ #region 离散单 (离散单只增加不修改)
+ if (p_modtype == BillModType.Non_Contract)
+ {
+ var _entity = list.FirstOrDefault();
+ TB_PO _po = new TB_PO();
+ _po.GUID = Guid.NewGuid();
+ _po.PoBillNum = SCP_BILLCODE_CONTROLLER.MakePoNum(_num);
+ _po.State = (int)PoState.Open;
+ _po.Site = site.Trim().ToUpper();
+ _po.SubSite = subsite.Trim().ToUpper();
+ _po.VendId = _entity.供应商编号.Trim().ToUpper();
+ _po.ErpBillNum = _po.PoBillNum;
+ _po.ModType = (int)p_modtype;
+ _po.Contacter = p_chineseName;// _entity.联系人;
+ _po.Buyer = p_chineseName;// _entity.联系人;
+ _po.BuyerPhone = p_buyerPhone;
+ _po.Site = site.Trim().ToUpper();
+ _po.Remark = _entity.备注;
+ _po.IsDeleted = false;
+ _po.CreateTime = DateTime.Now;
+ _po.CreateUser = p_creator;
+ _po.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(_entity.要求到货日期);
+ scpdb.TB_PO.AddOrUpdate(_po);
+ TB_ASK _ask = new TB_ASK();
+ _ask.AskBillNum = SCP_BILLCODE_CONTROLLER.MakeASKCodeByNum(_num);
+ _ask.GUID = Guid.NewGuid();
+ _ask.PoBillNum = _po.PoBillNum;
+ _ask.VendId = _entity.供应商编号.Trim().ToUpper();
+ _ask.IsDeleted = false;
+ _ask.CreateTime = DateTime.Now;
+ _ask.CreateUser = p_creator;
+ _ask.Site = site.Trim().ToUpper();
+ _ask.ReceivedPort = "";//交货口
+ _ask.State = (int)AskState.New;
+ _ask.Remark = _entity.备注;
+ _ask.ModType = (int)p_modtype;
+ _ask.ErpBillNum = _po.PoBillNum;
+ _ask.BeginTime = p_time;
+ _ask.EndTime = DateTime.Parse(_entity.要求到货日期);
+ _ask.Buyer = p_chineseName;
+ _ask.BuyerPhone = p_buyerPhone;
+ _ask.SubSite = subsite;
+ scpdb.TB_ASK.Add(_ask);
+
+ TED_PO_MSTR _po_mstr = new TED_PO_MSTR();
+ _po_mstr.GUID = Guid.NewGuid();
+ _po_mstr.PurchaseOrder = _po.PoBillNum;
+ _po_mstr.Supplier = _entity.供应商编号.Trim().ToUpper();
+ _po_mstr.Contact = p_chineseName;// _entity.联系人;
+ _po_mstr.ShipTo = subsite.Trim().ToUpper();//发往
+ _po_mstr.OrderDate = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po_mstr.DueDate = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now : DateTime.Parse(_entity.要求到货日期);
+ _po_mstr.StartDate = string.IsNullOrEmpty(_entity.订单开始时间) ? DateTime.Now : DateTime.Parse(_entity.订单开始时间);//订单日期
+ _po_mstr.EndDate = string.IsNullOrEmpty(_entity.订单截至日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(_entity.订单截至日期);
+ _po_mstr.MadeIn = "";
+ _po_mstr.Confirm = true;
+ _po_mstr.Buyer = p_chineseName;// _entity.采购员;
+ _po_mstr.BuyerPhone = p_buyerPhone;// _entity.采购员电话;
+ _po_mstr.Status = (int)PoState.Open;
+ _po_mstr.ScheduledOrder = false;
+ _po_mstr.CreateUser = p_creator;
+ _po_mstr.CreateTime = p_time;
+ _po_mstr.Remark = _entity.备注; ;
+ _po_mstr.TaskID = taskid;
+ _po_mstr.CommandType = "A";
+ _po_mstr.Domain = site.Trim().ToUpper();
+ _po_mstr.ModeType = ((int)p_modtype).ToString();
+ _po_mstr.Site = subsite.Trim().ToUpper();
+ _po_mstr.DataID = Guid.NewGuid();
+ _po_mstr.Pricelist = _entity.供应商编号.ToUpper().Trim() + subsite.Substring(1, 1) + subsite.Substring(3, 1);
+ _po_mstr.Taxclass = _entity.税率;
+ db.TED_PO_MSTR.Add(_po_mstr);
+
+ int _number = 1;
+ list.ForEach((itm) =>
+ {
+ TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
+ _PO_Detail.GUID = Guid.NewGuid();
+ _PO_Detail.PartCode = itm.零件号.Trim().ToUpper();
+ _PO_Detail.PoLine = _number;
+ _PO_Detail.PoBillNum = _po.PoBillNum;
+ _PO_Detail.State = (int)PoState.Open;
+ _PO_Detail.Site = site.Trim().ToUpper();
+ _PO_Detail.SubSite = subsite.Trim().ToUpper();
+ _PO_Detail.Currency = "CNY";
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.Remark = itm.备注;
+ _PO_Detail.CreateTime = DateTime.Now;
+ _PO_Detail.CreateUser = p_creator;
+ _PO_Detail.BeginTime = string.IsNullOrEmpty(itm.订单创建时间) ? DateTime.Now : DateTime.Parse(itm.订单创建时间);
+ _PO_Detail.EndTime = string.IsNullOrEmpty(itm.要求到货日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(itm.要求到货日期);
+ _PO_Detail.PlanQty = decimal.Parse(itm.数量);
+ _PO_Detail.IsDeleted = false;
+ _PO_Detail.LocUnit = itm.单位;
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.UnConv = 1;
+ _PO_Detail.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ _PO_Detail.TempQty = decimal.Parse(itm.数量);
+ TB_ASK_DETAIL _tDetail = new TB_ASK_DETAIL();
+ _tDetail.Remark = itm.备注;
+ _tDetail.PoBillNum = _po.PoBillNum;
+ _tDetail.AskBillNum = _ask.AskBillNum;
+ _tDetail.PoLine = _number;
+ _tDetail.PoUnit = itm.单位;
+ _tDetail.CreateTime = DateTime.Now;
+ _tDetail.CreateUser = p_creator;
+ _tDetail.PartCode = itm.零件号.ToUpper().Trim();
+ _tDetail.ReceivedPort = "";
+ _tDetail.BeginTime = p_time;
+ _tDetail.EndTime = Convert.ToDateTime(itm.要求到货日期);
+ _tDetail.TempQty = 0;
+ _tDetail.AskQty = Decimal.Parse(itm.数量);
+ _tDetail.IsDeleted = false;
+ _tDetail.LocUnit = itm.单位;
+ _tDetail.UnConv = 1;
+ _tDetail.State = (int)PoState.Open;
+ _tDetail.SubSite = subsite.Trim().ToUpper();
+ _tDetail.Site = site.Trim().ToUpper();
+ _tDetail.Price = Decimal.Parse(itm.单价);
+ _tDetail.GUID = Guid.NewGuid();
+ _tDetail.Currency = itm.币种;
+ scpdb.TB_ASK_DETAIL.Add(_tDetail);
+ scpdb.TB_PO_DETAIL.AddOrUpdate(_PO_Detail);
+ TED_PO_DET _PO_Detail_Det = new TED_PO_DET();
+ _PO_Detail_Det.GUID = Guid.NewGuid();
+ _PO_Detail_Det.PurchaseOrder = _po.PoBillNum;
+ _PO_Detail_Det.Line = _number;
+ _PO_Detail_Det.Currency = "CNY";
+ _PO_Detail_Det.PoType = itm.订单类型;
+ _PO_Detail_Det.PartCode = itm.零件号.Trim().ToUpper();
+ _PO_Detail_Det.Qty = decimal.Parse(itm.数量);
+ _PO_Detail_Det.QtyOpen = 0;
+ _PO_Detail_Det.PackQty = 1;
+ _PO_Detail_Det.Currency = itm.币种;
+ _PO_Detail_Det.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ _PO_Detail_Det.PoUm = itm.单位;
+ _PO_Detail_Det.LocUm = itm.单位;
+ _PO_Detail_Det.Conv = 1;
+ _PO_Detail_Det.DueDate = string.IsNullOrEmpty(itm.要求到货日期) ? DateTime.Now : DateTime.Parse(itm.要求到货日期);
+ _PO_Detail_Det.Status = (int)PoState.Open;
+ _PO_Detail_Det.CreateTime = DateTime.Parse(itm.订单创建时间);
+ _PO_Detail_Det.StartDate = string.IsNullOrEmpty(itm.零件开始时间) ? p_time : DateTime.Parse(itm.零件开始时间);
+ _PO_Detail_Det.EndDate = string.IsNullOrEmpty(itm.零件截至日期) ? DateTime.Now.AddYears(10) : DateTime.Parse(itm.零件截至日期);
+ _PO_Detail_Det.CreateUser = p_creator;
+ _PO_Detail_Det.TaskID = taskid;
+ _PO_Detail_Det.CommandType = "A";
+ _PO_Detail_Det.DataID = Guid.NewGuid();
+ _PO_Detail_Det.Domain = site.Trim().ToUpper();
+ _PO_Detail_Det.Site = subsite.Trim().ToUpper();
+ _PO_Detail_Det.Workorderlot = itm.加工单号;
+ _PO_Detail_Det.PoType = itm.订单类型;
+ _PO_Detail_Det.Operation = string.IsNullOrEmpty(itm.工序) ? 0 : int.Parse(itm.工序);
+ _PO_Detail_Det.Location = itm.库位;
+ _PO_Detail_Det.Firmdays = string.IsNullOrEmpty(itm.固定天数) ? 7 : int.Parse(itm.固定天数);
+ _PO_Detail_Det.Scheduledays = string.IsNullOrEmpty(itm.日程天数) ? 7 : int.Parse(itm.日程天数);
+ _PO_Detail_Det.Scheduleweeks = string.IsNullOrEmpty(itm.日程周数) ? 2 : int.Parse(itm.日程周数);
+ _PO_Detail_Det.Schedulemonth = string.IsNullOrEmpty(itm.日程月数) ? 1 : int.Parse(itm.日程月数);
+ _PO_Detail_Det.Supplieritem = itm.供应商零件;
+ _PO_Detail_Det.Dliverypatterncode = itm.发货样式;
+ _PO_Detail_Det.Deliverytimecode = itm.发货时间样式;
+ _PO_Detail_Det.Transportdays = string.IsNullOrEmpty(itm.运输周期) ? 0 : int.Parse(itm.运输周期);
+ _PO_Detail_Det.Pricelist = _entity.供应商编号.ToUpper() + subsite.Substring(1, 1) + subsite.Substring(3, 1);
+ db.TED_POD_DET.Add(_PO_Detail_Det);
+ _number++;
+ });
+ _polist = _polist + _po.PoBillNum + ",";
+ }
+ #endregion
+ }
+ var ret = CREATE_TEA_TASK_SUB(db, true, new TEA_TASK_SUB()
+ {
+ DataCount = 1,
+ TaskID = taskid,
+ TableName = "TED_PO_MSTR",
+ Site = subsite.Trim().ToUpper(),
+ Domain = site.Trim().ToUpper(),
+ CreateTime = p_time,
+ CreateUser = p_creator,
+ Creator = "SCP",
+ });
+ _num++;
+ Thread.Sleep(10);
+ }
+ );
+ EntitiesFactory.SaveDb(scpdb);
+ EntitiesFactory.SaveDb(db);
+ scope.Complete();
+ _ret.State = ReturnStatus.Succeed;
+ _ret.Result = true;
+ _ret.Message = _polist;
+
+ }
+ catch (Exception e)
+ {
+ _ret.State = ReturnStatus.Failed;
+ LogHelper.Writlog(LogHelper.LogType.Error, typeof(TEA_TASK_SUB), "InsterPo", e.Message);
+ _ret.Result = false;
+ _ret.Message = e.InnerException.Message;
+ scope.Dispose();
+
+ }
+ }
+ return _ret;
+ }
//public static ResultObject UpdateTES_PURCHASE_PRICE(List p_list, string domain, string site, string name, bool flag,int ConfirmState)
//{
-
+
// ResultObject _ret = new ResultObject();
// if (ConfirmState!=(int)PriceState.FConfirm)
// {
@@ -1916,7 +2272,7 @@ namespace CK.SCP.Controller
// ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
// List _teslist = new List();
// var _ls = scpdb.V_TB_PRICE.Where(p => p_list.Contains(p.UID)).ToList();
-
+
// foreach (var _price in _ls)
// {
// Guid _taskguid = Guid.NewGuid();
@@ -2018,7 +2374,7 @@ namespace CK.SCP.Controller
// ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
// ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
// var OrderList = p_order_list.GroupBy(p => p.订单编号).ToList();
- // string _polist = "";
+ // string _polist = "";
// int _num = 1;
// OrderList.ForEach((p) =>
// {
@@ -2030,7 +2386,7 @@ namespace CK.SCP.Controller
// if (p_modtype == BillModType.Contract)
// {
// var _entity = list.FirstOrDefault();
- // var _po = scpdb.TB_PO.SingleOrDefault(t => t.PoBillNum == _entity.订单编号/* && t.State == state*/ && t.Site == site && t.SubSite == subsite && t.VendId == _entity.供应商编号.ToUpper());
+ // var _po = scpdb.TB_PO.SingleOrDefault(t => t.PoBillNum == _entity.订单编号/* && t.State == state*/ && t.Site == site && t.SubSite == subsite && t.VendId == _entity.供应商编号.ToUpper());
// TED_PO_MSTR _po_mstr = new TED_PO_MSTR();
// _po_mstr.GUID = Guid.NewGuid();
// _po_mstr.PurchaseOrder = _entity.订单编号.Trim().ToUpper();
@@ -2068,7 +2424,7 @@ namespace CK.SCP.Controller
// }
// db.TED_PO_MSTR.Add(_po_mstr);
- // _po.ErpBillNum = _entity.订单编号.Trim().ToUpper();;
+ // _po.ErpBillNum = _entity.订单编号.Trim().ToUpper(); ;
// _po.ModType = (int)p_modtype;
// _po.Contacter = p_chineseName;// _entity.联系人;
// _po.Buyer = p_chineseName;// _entity.联系人;
@@ -2111,7 +2467,7 @@ namespace CK.SCP.Controller
// else
// {
// _PO_Detail_Det.PoUm = _part.Unit;
- // _PO_Detail_Det.LocUm =_part.Unit;
+ // _PO_Detail_Det.LocUm = _part.Unit;
// }
// _PO_Detail_Det.Conv = 1;
// _PO_Detail_Det.DueDate = string.IsNullOrEmpty(itm.要求到货日期) ? DateTime.Now : DateTime.Parse(itm.要求到货日期);
@@ -2134,7 +2490,7 @@ namespace CK.SCP.Controller
// _PO_Detail_Det.Domain = site.Trim().ToUpper();
// _PO_Detail_Det.Site = subsite.Trim().ToUpper();
// _PO_Detail_Det.Workorderlot = itm.加工单号;
- // _PO_Detail_Det.PoType = itm.订单类型;
+ // _PO_Detail_Det.PoType = itm.订单类型;
// _PO_Detail_Det.Operation = string.IsNullOrEmpty(itm.工序) ? 0 : int.Parse(itm.工序);
// _PO_Detail_Det.Location = itm.库位;
// _PO_Detail_Det.Firmdays = string.IsNullOrEmpty(itm.固定天数) ? 7 : int.Parse(itm.固定天数);
@@ -2161,7 +2517,7 @@ namespace CK.SCP.Controller
// _PO_Detail.Remark = itm.备注;
// _PO_Detail.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
// _PO_Detail.Workorderlot = string.IsNullOrEmpty(itm.加工单号) ? 0 : int.Parse(itm.加工单号);
- // _PO_Detail.PoType =itm.订单类型;
+ // _PO_Detail.PoType = itm.订单类型;
// _PO_Detail.Operation = string.IsNullOrEmpty(itm.工序) ? 0 : int.Parse(itm.工序);
// _PO_Detail.Location = itm.库位;
// _PO_Detail.Firmdays = string.IsNullOrEmpty(itm.固定天数) ? 7 : int.Parse(itm.固定天数);
@@ -2225,7 +2581,7 @@ namespace CK.SCP.Controller
// scpdb.TB_ASK.Add(_ask);
// TED_PO_MSTR _po_mstr = new TED_PO_MSTR();
// _po_mstr.GUID = Guid.NewGuid();
-
+
// _po_mstr.PurchaseOrder = _po.PoBillNum;
// _po_mstr.Supplier = _entity.供应商编号.Trim().ToUpper();
// _po_mstr.Contact = p_chineseName;// _entity.联系人;
@@ -2380,7 +2736,7 @@ namespace CK.SCP.Controller
// scope.Complete();
// _ret.State = ReturnStatus.Succeed;
// _ret.Result = true;
- // _ret.Message= _polist;
+ // _ret.Message = _polist;
// }
// catch (Exception e)
@@ -2557,7 +2913,7 @@ namespace CK.SCP.Controller
// {
// Guid taskid = Guid.NewGuid();
// TED_PO_MSTR item = new TED_PO_MSTR();
-
+
// var _mstr = scpdb.TB_PO.FirstOrDefault(t => t.PoBillNum == _num && t.State == (int)PoState.Open);
// if (_mstr!= null)
// {
diff --git a/Controller/SCP_PO_CONTROLLER.cs b/Controller/SCP_PO_CONTROLLER.cs
index ec4d00b..4db65b5 100644
--- a/Controller/SCP_PO_CONTROLLER.cs
+++ b/Controller/SCP_PO_CONTROLLER.cs
@@ -12,6 +12,7 @@ using CK.SCP.Utils;
using System.Data.Entity.Core;
using CK.SCP.Models.ScpEntity.ExcelExportEnttity;
using System.Text.RegularExpressions;
+using System.Threading;
namespace CK.SCP.Controller
{
@@ -634,9 +635,622 @@ namespace CK.SCP.Controller
return ErrorList;
}
+ public static ResultObject Save_EXCEL_PO_MOD(List p_order_list, string site, string p_creator, DateTime p_time, BillModType p_modtype, string subsite, string p_chineseName, string p_buyerPhone)
+ {
+ ResultObject _ret = new ResultObject();
+ try
+ {
+ using (ScpEntities db = EntitiesFactory.CreateScpInstance())
+ {
+ List lineError = new List();
+ List ErrorList = new List();
+ var _lst = p_order_list;
+ string _polist = "";
+ int _num = 1;
+ var OrderList = _lst.GroupBy(p => p.订单编号).ToList();
+ OrderList.ForEach((p) =>
+ {
+ var list = p.ToList();
+ if (list.Count > 0)
+ {
+ #region 日程单
+ if (p_modtype == BillModType.Contract)
+ {
+ var _entity = list.FirstOrDefault();
+ var _po = db.TB_PO.SingleOrDefault(t => t.PoBillNum == _entity.订单编号/* && t.State == state*/ && t.Site == site && t.SubSite == subsite && t.VendId == _entity.供应商编号.ToUpper()) ??
+ new TB_PO { GUID = Guid.NewGuid(), PoBillNum = _entity.订单编号.ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite, VendId = _entity.供应商编号.ToUpper() };
+ _po.ErpBillNum = _entity.订单编号.ToUpper();
+ _po.ModType = (int)p_modtype;
+ _po.Contacter = p_chineseName;// _entity.联系人;
+ _po.Buyer = p_chineseName;// _entity.联系人;
+ _po.BuyerPhone = p_buyerPhone;
+ _po.Site = site;
+ _po.Remark = _entity.备注;
+ _po.IsDeleted = false;
+ _po.CreateTime = DateTime.Parse(_entity.订单创建时间);
+ _po.CreateUser = p_creator;
+ _po.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(30) : DateTime.Parse(_entity.要求到货日期);
+ db.TB_PO.AddOrUpdate(_po);
+ list.ForEach((itm) =>
+ {
+ int _poline = Int32.Parse(itm.行号);
+ var _PO_Detail = db.TB_PO_DETAIL.FirstOrDefault(t => t.PartCode == itm.零件号 && t.PoLine == _poline && t.PoBillNum == itm.订单编号 /*&& t.State == state*/ && t.Site == site && t.SubSite == subsite) ??
+ new TB_PO_DETAIL { GUID = Guid.NewGuid(), PartCode = itm.零件号.ToUpper(), PoLine = _poline, PoBillNum = itm.订单编号.ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite };
+ _PO_Detail.Currency = "CNY";
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.CreateTime = DateTime.Parse(itm.订单创建时间);
+ _PO_Detail.CreateUser = p_creator;
+ _PO_Detail.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _PO_Detail.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(30) : DateTime.Parse(_entity.要求到货日期);
+ _PO_Detail.PlanQty = decimal.Parse(itm.数量);
+ _PO_Detail.IsDeleted = false;
+ _PO_Detail.LocUnit = itm.单位;
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.UnConv = 1;
+ _PO_Detail.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ db.TB_PO_DETAIL.AddOrUpdate(_PO_Detail);
+ });
+ _polist = _polist + _po.PoBillNum + ",";
+ }
+ #endregion
+ #region 离散单
+ if (p_modtype == BillModType.Non_Contract)
+ {
+ var _entity = list.FirstOrDefault();
+ TB_PO _po = new TB_PO();
+ _po.GUID = Guid.NewGuid();
+ _po.PoBillNum = SCP_BILLCODE_CONTROLLER.MakePoNum(_num);
+ _po.State = (int)PoState.Open;
+ _po.Site = site;
+ _po.SubSite = subsite;
+ _po.VendId = _entity.供应商编号.ToUpper();
+ _po.ErpBillNum = _po.PoBillNum;
+ _po.ModType = (int)p_modtype;
+ _po.Contacter = p_chineseName;// _entity.联系人;
+ _po.Buyer = p_chineseName;// _entity.联系人;
+ _po.BuyerPhone = p_buyerPhone;
+ _po.Site = site;
+ _po.Remark = _entity.备注;
+ _po.IsDeleted = false;
+ _po.CreateTime = DateTime.Parse(_entity.订单创建时间);
+ _po.CreateUser = p_creator;
+ _po.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _po.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(30) : DateTime.Parse(_entity.要求到货日期);
+ db.TB_PO.AddOrUpdate(_po);
+ TB_ASK _ask = new TB_ASK();
+ _ask.AskBillNum = SCP_BILLCODE_CONTROLLER.MakeASKCodeByNum(_num);
+ _ask.GUID = Guid.NewGuid();
+ _ask.PoBillNum = _po.PoBillNum;
+ _ask.VendId = _entity.供应商编号.ToUpper();
+ _ask.IsDeleted = false;
+ _ask.CreateTime = DateTime.Now;
+ _ask.CreateUser = p_creator;
+ _ask.Site = site;
+ _ask.ReceivedPort = "";//交货口
+ _ask.State = (int)AskState.New;
+ _ask.Remark = _entity.备注;
+ _ask.ModType = (int)p_modtype;
+ _ask.ErpBillNum = _po.PoBillNum;
+ _ask.BeginTime = p_time;
+ _ask.EndTime = DateTime.Parse(_entity.要求到货日期);
+ _ask.Buyer = p_chineseName;
+ _ask.BuyerPhone = p_buyerPhone;
+ _ask.SubSite = subsite;
+ db.TB_ASK.Add(_ask);
+ int _number = 1;
+ list.ForEach((itm) =>
+ {
+ TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
+ _PO_Detail.GUID = Guid.NewGuid();
+ _PO_Detail.PartCode = itm.零件号.Trim().ToUpper();
+ _PO_Detail.PoLine = _number;
+ _PO_Detail.PoBillNum = _po.PoBillNum;
+ _PO_Detail.State = (int)PoState.Open;
+ _PO_Detail.Site = site;
+ _PO_Detail.SubSite = subsite;
+ _PO_Detail.Currency = "CNY";
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.CreateTime = DateTime.Parse(itm.订单创建时间);
+ _PO_Detail.CreateUser = p_creator;
+ _PO_Detail.BeginTime = string.IsNullOrEmpty(_entity.订单创建时间) ? DateTime.Now : DateTime.Parse(_entity.订单创建时间);
+ _PO_Detail.EndTime = string.IsNullOrEmpty(_entity.要求到货日期) ? DateTime.Now.AddYears(30) : DateTime.Parse(_entity.要求到货日期);
+ _PO_Detail.PlanQty = decimal.Parse(itm.数量);
+ _PO_Detail.IsDeleted = false;
+ _PO_Detail.LocUnit = itm.单位;
+ _PO_Detail.PoUnit = itm.单位;
+ _PO_Detail.UnConv = 1;
+ _PO_Detail.Price = string.IsNullOrEmpty(itm.单价) ? 0 : decimal.Parse(itm.单价);
+ _PO_Detail.TempQty = decimal.Parse(itm.数量);
+ TB_ASK_DETAIL _tDetail = new TB_ASK_DETAIL();
+ _tDetail.Remark = itm.备注;
+ _tDetail.PoBillNum = _po.PoBillNum;
+ _tDetail.AskBillNum = _ask.AskBillNum;
+ _tDetail.PoLine = _number;
+ _tDetail.PoUnit = itm.单位;
+ _tDetail.CreateTime = DateTime.Now;
+ _tDetail.CreateUser = p_creator;
+ _tDetail.PartCode = itm.零件号.Trim().ToUpper();
+ _tDetail.ReceivedPort = "";
+ _tDetail.BeginTime = p_time;
+ _tDetail.EndTime = Convert.ToDateTime(itm.要求到货日期);
+ _tDetail.TempQty = 0;
+ _tDetail.AskQty = Decimal.Parse(itm.数量);
+ _tDetail.IsDeleted = false;
+ _tDetail.LocUnit = itm.单位;
+ _tDetail.UnConv = 1;
+ _tDetail.State = (int)PoState.Open;
+ _tDetail.SubSite = subsite;
+ _tDetail.Site = site;
+ _tDetail.Price = Decimal.Parse(itm.单价);
+ _tDetail.GUID = Guid.NewGuid();
+ _tDetail.Currency = itm.币种;
+ db.TB_ASK_DETAIL.Add(_tDetail);
+ db.TB_PO_DETAIL.AddOrUpdate(_PO_Detail);
+ _number++;
+ });
+ _polist = _polist + _po.PoBillNum + "";
+ }
+ #endregion
+ }
+ else
+ {
+ _ret.MessageList.Add("订单导入有误!");
+ return;
+ }
+ _num++;
+ Thread.Sleep(10);
+ }
+ );
+ if (_ret.MessageList.Count == 0)
+ {
+ int state = db.SaveChanges();
+ if (state != -1)
+ {
+ _ret.State = ReturnStatus.Succeed;
+ _ret.Result = true;
+ _ret.Message = _polist;
+ }
+ else
+ {
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ }
+ }
+ 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_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", e.Message);
+ _ret.Result = false;
+ _ret.ErrorList.Add(e);
+ throw e;
+ }
+ return _ret;
+
+ }
+ public static ResultObject Check_EXCEL_PO_MOD(List p_order_list, BillModType p_modtype, string site, string subsite)
+ {
+ ResultObject _ret = new ResultObject();
+ try
+ {
+ using (ScpEntities db = EntitiesFactory.CreateScpInstance())
+ {
+ int number = 1;
+ List lineError = new List();
+ List ErrorList = new List();
+ var _lst = p_order_list;
+ p_order_list.ForEach(p =>
+ {
+ var _count1 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.行号 == p.行号);
+ var _count2 = _lst.Count(itm => itm.订单编号 == p.订单编号 && itm.零件号 == p.零件号);
+ if (_count1 > 1 && p_modtype == BillModType.Contract)
+ {
+ lineError.Add(string.Format("导入订单编号【{0}】行号【{1}】有重复", p.订单编号, p.行号));
+ ErrorList = lineError;
+ }
+ if (_count2 > 1)
+ {
+ lineError.Add(string.Format("导入订单编号【{0}】零件编码【{1}】有重复", p.订单编号, p.零件号));
+ ErrorList = lineError;
+ }
+ });
+ p_order_list.ForEach
+ (p =>
+ {
+ var _ls = CheckExcelMode_Po(db, p, p_modtype, site, subsite);
+ if (_ls.Count > 0)
+ {
+ lineError.Add(number.ToString());
+ ErrorList.Add(string.Join("
", _ls.ToArray()));
+ }
+ number++;
+ });
+ if (lineError.Count > 0)
+ {
+ _ret.State = ReturnStatus.Failed;
+ _ret.MessageList.AddRange(ErrorList);
+ _ret.Result = false;
+ }
+ else
+ {
+ _ret.State = ReturnStatus.Succeed;
+ _ret.Result = 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);
+ });
+ }
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.ErrorList.Add(dbEx);
+ LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", 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_PO_CONTROLLER), "EXCEL_PO_MOD", e.Message);
+ _ret.Result = false;
+ _ret.ErrorList.Add(e);
+ throw e;
+ }
+ return _ret;
+
+ }
+ ///
+ /// 订单导入检查
+ ///
+ ///
+ ///
+ ///
+ private static List CheckExcelMode_Po(ScpEntities db, SCP_PO_EXPORT_IMPORT_MODEL p_excel, BillModType p_modtype, string site = null, string subsite = null)
+ {
+ List ErrorList = new List();
+
+ decimal _result = 0;
+ if (!decimal.TryParse(p_excel.数量, out _result))
+ {
+ ErrorList.Add(string.Format("订单编号【{0}】零件编号【{1}】数量填写有问题", p_excel.订单编号, p_excel.数量));
+ }
+ var _checkpart = db.TA_PART.FirstOrDefault(p => p.PartCode == p_excel.零件号);
+ if (_checkpart != null)
+ {
+ if (_checkpart.State.ToUpper() != "SP")
+ {
+ p_excel.单位 = _checkpart.Unit;
+ }
+ else
+ {
+ ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表零件停用,无法导入!", p_excel.订单编号, p_excel.零件号));
+ }
+ }
+ else
+ {
+ ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表里无数据,无法导入!", p_excel.订单编号, p_excel.零件号));
+ }
+
+ DateTime _d = DateTime.Now;
+
+ #region 日程单验证
+
+
+
+ if (p_modtype == BillModType.Contract)
+ {
+ if (string.IsNullOrEmpty(p_excel.订单编号) || string.IsNullOrEmpty(p_excel.行号) || string.IsNullOrEmpty(p_excel.订单创建时间) ||
+ string.IsNullOrEmpty(p_excel.要求到货日期) || string.IsNullOrEmpty(p_excel.零件号) || string.IsNullOrEmpty(p_excel.数量))
+ {
+ ErrorList.Add(string.Format("分组【{1}】零件名称【{0}】有填写为空!", p_excel.零件号, p_excel.订单编号));
+ }
+ else
+ {
+ if (!string.IsNullOrEmpty(p_excel.零件截至日期))
+ {
+ DateTime year = DateTime.Parse(p_excel.零件截至日期);
+ if (year.Year > 2049)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的零件截止日期必须大于等于2049年!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ if (!string.IsNullOrEmpty(p_excel.订单截至日期))
+ {
+ DateTime year = DateTime.Parse(p_excel.订单截至日期);
+ if (year.Year > 2049)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ string _ponumber = p_excel.供应商编号.ToUpper() + subsite.Substring(1, 1) + subsite.Substring(3, 1);
+ if (p_excel.订单编号.ToUpper() != _ponumber.ToUpper())
+ {
+ ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel.订单编号, p_excel.行号, p_excel.零件号));
+ }
+
+ int _polinr = Int32.Parse(p_excel.行号);
+ var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel.订单编号 && p.PartCode == p_excel.零件号 && p.PoLine != _polinr).ToList();
+ if (_partlist.Count > 0)
+ {
+ ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel.订单编号, p_excel.零件号, _partlist[0].PoLine));
+ }
+ int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel.订单编号 && p.PoLine == _polinr && p.PartCode != p_excel.零件号);
+ if (linecount > 0)
+ {
+ ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel.订单编号, p_excel.行号));
+ }
+ var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号 && p.Site == site && p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
+ if (checkcount.Count == 0)
+ {
+ ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel.零件号, p_excel.供应商编号));
+ }
+ else
+ {
+ p_excel.单价 = checkcount[0].Amt.ToString();
+ p_excel.单位 = checkcount[0].Unit;
+ p_excel.币种 = checkcount[0].Curr;
+ }
+
+ if (p_excel.数量 != "0")
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的要货数量应该为零!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (DateTime.TryParse(p_excel.订单创建时间, out _d) && DateTime.TryParse(p_excel.订单创建时间, out _d))
+ {
+ if (DateTime.Parse(p_excel.要求到货日期) < DateTime.Parse(p_excel.订单创建时间))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】要求到货日期不能小于订单创建时间日期!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ else
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单创建日期或要求到货日期要求为文本格式!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!Regex.IsMatch(p_excel.税率, "^[0-9]{1,2}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】税率最大应为2位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.订单类型))
+ {
+ if (p_excel.订单类型.ToUpper() == "S")
+ {
+ if (string.IsNullOrEmpty(p_excel.加工单号) || !Regex.IsMatch(p_excel.加工单号, "^[0-9]{1,8}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】加工单最大8位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (string.IsNullOrEmpty(p_excel.工序) || !Regex.IsMatch(p_excel.工序, "^[0-9]{1,6}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】工序最大6位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ else
+ {
+ ErrorList.Add(string.Format("{0}订单类型必须填写为S为转包订单,不填写为正常订单", p_excel.订单编号));
+ }
+ //注释结束
+ }
+ if (!string.IsNullOrEmpty(p_excel.库位) && p_excel.库位.Length > 8)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】库位最大8位字符!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.固定天数) && !Regex.IsMatch(p_excel.固定天数, "^[0-9]{1,4}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】固定天数最大4位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.日程天数) && !Regex.IsMatch(p_excel.日程天数, "^[0-9]{1,3}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】日程天数最大3位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.日程周数) && !Regex.IsMatch(p_excel.日程周数, "^[0-9]{1,3}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】日程周数最大3位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.日程月数) && !Regex.IsMatch(p_excel.日程月数, "^[0-9]{1,3}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】日程月数最大3位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.发货样式) && p_excel.发货样式.Length > 2)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】发货样式最大2位字符!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.发货时间样式) && p_excel.发货时间样式.Length > 2)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】发货时间样式最大2位字符!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.运输周期) && !Regex.IsMatch(p_excel.运输周期, "^[0-9]{1,3}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】运输周期最大3位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.库位) && p_excel.库位.Length > 8)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】库位最大8位字符!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ }
+ #endregion
+ #region 离散单验证
+
+
+
+ if (p_modtype == BillModType.Non_Contract)
+ {
+ if (/*string.IsNullOrEmpty(p_excel.订单编号) ||string.IsNullOrEmpty(p_excel.行号) ||*/ string.IsNullOrEmpty(p_excel.订单截至日期) ||
+ string.IsNullOrEmpty(p_excel.要求到货日期) || string.IsNullOrEmpty(p_excel.零件号) || string.IsNullOrEmpty(p_excel.数量) ||
+ string.IsNullOrEmpty(p_excel.订单创建时间)/* || string.IsNullOrEmpty(p_excel.税率)*/)
+ {
+ ErrorList.Add(string.Format("分组【{1}】零件名称【{0}】有填写为空!", p_excel.零件号, p_excel.订单编号));
+ }
+ else
+ {
+ decimal a = decimal.Parse(p_excel.数量);
+ if (a <= 0)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的数量不能小于等于0", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.零件截至日期))
+ {
+ DateTime year = DateTime.Parse(p_excel.零件截至日期);
+ if (year.Year > 2049)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的零件截止日期必须大于等于2049年!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ if (!string.IsNullOrEmpty(p_excel.订单截至日期))
+ {
+ DateTime year = DateTime.Parse(p_excel.订单截至日期);
+ if (year.Year > 2049)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号 && p.Site == site&& p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
+ if (checkcount.Count == 0)
+ {
+ ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel.零件号, p_excel.供应商编号));
+ }
+ else
+ {
+ p_excel.单价 = checkcount[0].Amt.ToString();
+ p_excel.单位 = checkcount[0].Unit;
+ p_excel.币种 = checkcount[0].Curr;
+ }
+ //if (!Regex.IsMatch(p_excel.税率, "^[0-9]{1,2}$"))
+ //{
+ // ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】税率最大2位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ //}
+ if (DateTime.TryParse(p_excel.订单创建时间, out _d) && DateTime.TryParse(p_excel.订单创建时间, out _d))
+ {
+ if (DateTime.Parse(p_excel.要求到货日期) < DateTime.Parse(p_excel.订单创建时间))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】要求到货日期不能小于订单创建时间日期!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ else
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单创建日期或要求到货日期要求为文本格式!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (!string.IsNullOrEmpty(p_excel.订单类型))
+ {
+ if (p_excel.订单类型.ToUpper() != "S" && p_excel.订单类型.ToUpper() != "M")
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单类型只能为M或S!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ //注释结束
+ if (p_excel.订单类型.ToUpper() == "S")
+ {
+ if (string.IsNullOrEmpty(p_excel.加工单号) || !Regex.IsMatch(p_excel.加工单号, "^[0-9]{1,8}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】加工单最大8位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ if (string.IsNullOrEmpty(p_excel.工序) || !Regex.IsMatch(p_excel.工序, "^[0-9]{1,6}$"))
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】工序最大6位整数!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ }
+ if (!string.IsNullOrEmpty(p_excel.库位) && p_excel.库位.Length > 8)
+ {
+ ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】库位最大8位字符!", p_excel.零件号, p_excel.供应商编号, p_excel.订单编号));
+ }
+ }
+ }
+ #endregion
+ return ErrorList;
+ }
private static List CheckExcelMode(ScpEntities db, SCP_PO_DETAIL_EXPORT_MODEL p_excel)
{
List ErrorList = new List();
diff --git a/Models/AppBoxEntity/User.cs b/Models/AppBoxEntity/User.cs
index 0050037..1278da1 100644
--- a/Models/AppBoxEntity/User.cs
+++ b/Models/AppBoxEntity/User.cs
@@ -98,7 +98,7 @@ namespace CK.SCP.Models.AppBoxEntity
public Dictionary ConfigList { set; get; }
[NotMapped]
- public List SiteList { set; get; }
+ public List SubSiteList { set; get; }
[NotMapped]
public string UsedDomain { set; get; }
diff --git a/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs b/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs
index 231aaef..66aea79 100644
--- a/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs
+++ b/Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs
@@ -81,6 +81,22 @@ 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/TB_PRICE.cs b/Models/ScpEntity/TB_PRICE.cs
index 17c1534..88213b1 100644
--- a/Models/ScpEntity/TB_PRICE.cs
+++ b/Models/ScpEntity/TB_PRICE.cs
@@ -27,7 +27,7 @@ namespace CK.SCP.Models.ScpEntity
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
- public int State { get; set; }
- public decimal? VendAmt { get; set; }
+ //public int State { get; set; }
+ //public decimal? VendAmt { get; set; }
}
}
diff --git a/SCP/Business/PageBase.cs b/SCP/Business/PageBase.cs
index 3789308..5e44e61 100644
--- a/SCP/Business/PageBase.cs
+++ b/SCP/Business/PageBase.cs
@@ -615,7 +615,7 @@ namespace SCP
_currentUser.RoleList = _currentUser.Roles.Select(p => p.Name).ToList();
var _userVerders = DB.VenderUsers.Where(p => p.UserId == _currentUser.ID).Select(p => p.VenderId).ToList();
_currentUser.FactoryList = _factoryList;
- _currentUser.SiteList = _siteList;
+ _currentUser.SubSiteList = _siteList;
_currentUser.VenderList = _userVerders;
_currentUser.ConfigList = new Dictionary();
if (_currentUser.FactoryList.Count > 0)
diff --git a/SCP/Properties/AssemblyInfo.cs b/SCP/Properties/AssemblyInfo.cs
index 47fb291..532507f 100644
--- a/SCP/Properties/AssemblyInfo.cs
+++ b/SCP/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// 可以指定所有值,也可以使用“修订号”和“内部版本号”的默认值,
// 方法是按如下所示使用 "*":
-[assembly: AssemblyVersion("1.21.0128.1")]
-[assembly: AssemblyFileVersion("1.21.0128.1")]
+[assembly: AssemblyVersion("1.21.0204.1")]
+[assembly: AssemblyFileVersion("1.21.0204.1")]
diff --git a/SCP/VersionUpdateInfo.txt b/SCP/VersionUpdateInfo.txt
index e1d7d02..a4c0b65 100644
--- a/SCP/VersionUpdateInfo.txt
+++ b/SCP/VersionUpdateInfo.txt
@@ -7,4 +7,10 @@ Version: 1.21.0128.1
TB_INVOIC 添加 SubSite和Site
登陆界面添加版本号
TA_VENDER 添加 SubSite
+////////////
+////////////
+
+Version: 1.21.0204.1
+ Info: TB_PRICE 去掉 State/VendAmt
+ 添加订单导入并且自动创建要货看板传接口共呢
////////////
\ No newline at end of file
diff --git a/SCP/Views/PlanData/SCP_PO.aspx b/SCP/Views/PlanData/SCP_PO.aspx
index b983d4a..38b97e3 100644
--- a/SCP/Views/PlanData/SCP_PO.aspx
+++ b/SCP/Views/PlanData/SCP_PO.aspx
@@ -47,8 +47,12 @@
-
-
+
+
+
+
+
+
diff --git a/SCP/Views/PlanData/SCP_PO.aspx.cs b/SCP/Views/PlanData/SCP_PO.aspx.cs
index 50a16d0..a81b0ee 100644
--- a/SCP/Views/PlanData/SCP_PO.aspx.cs
+++ b/SCP/Views/PlanData/SCP_PO.aspx.cs
@@ -202,6 +202,64 @@ namespace SCP.PlanData
}
}
+
+ protected void btnInput_Click_Contract(object sender, EventArgs e)
+ {
+ Excel_Input(BillModType.Contract);
+ }
+ protected void btnInput_Click_Non_Contract(object sender, EventArgs e)
+ {
+ Excel_Input(BillModType.Non_Contract);
+ }
+ protected void Excel_Input(BillModType p_modtype)
+ {
+ ResultObject saveret = new ResultObject();
+ string _fileName = FileUp.FileName;
+ if (string.IsNullOrEmpty(_fileName))
+ {
+ Alert.Show("选择文件为空!");
+ return;
+ }
+ string _lx = _fileName.Split('.')[1];
+ Stream _stream = FileUp.PostedFile.InputStream;
+ DataTable _dt = new DataTable();
+ if (_lx == "xls")
+ {
+ _dt = ExcelHelper.GetDataTable(_stream);
+ }
+ else
+ {
+ _dt = ExcelHelper.GetDataTableOfXlsx(_stream);
+ }
+
+ var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList();
+ var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]);
+ if (checkret.State == ReturnStatus.Failed && checkret.Result == false)
+ {
+ Alert.Show(string.Join("
", checkret.MessageList));
+ return;
+ }
+ if (CurrentUser.ConfigList.ContainsKey("数据中心接口"))
+ {
+ saveret = SCP_DC_UNI_CONTROLLER.WritePo(list, CurrentUser.FactoryList[0], CurrentUser.Name, DateTime.Now, p_modtype, CurrentUser.SubSiteList[0], CurrentUser.ChineseName, CurrentUser.CellPhone);
+ }
+ else
+ {
+ saveret = SCP_PO_CONTROLLER.Save_EXCEL_PO_MOD(list, CurrentUser.FactoryList[0], CurrentUser.Name, DateTime.Now, p_modtype, CurrentUser.SubSiteList[0], CurrentUser.ChineseName, CurrentUser.CellPhone);
+ }
+ if (saveret.State == ReturnStatus.Succeed && saveret.Result == true)
+ {
+ BindOrder();
+ Alert.Show("订单编号" + saveret.Message + "导入成功!");
+ return;
+ }
+ else
+ {
+ //Alert.Show(string.Join("
", saveret.MessageList));
+ Alert.Show(saveret.Message);
+ return;
+ }
+ }
protected void BTN_CREATE_Click(object sender, EventArgs e)
{
if (Grid_V_TB_PO.SelectedRowIndexArray.Count() == 0)
diff --git a/SCP/Views/PlanData/SCP_PO.aspx.designer.cs b/SCP/Views/PlanData/SCP_PO.aspx.designer.cs
index 68249b0..dbaf7e0 100644
--- a/SCP/Views/PlanData/SCP_PO.aspx.designer.cs
+++ b/SCP/Views/PlanData/SCP_PO.aspx.designer.cs
@@ -122,6 +122,24 @@ namespace SCP.PlanData
///
protected global::FineUI.FileUpload FileUp;
+ ///
+ /// btnInput_Contract 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUI.Button btnInput_Contract;
+
+ ///
+ /// btnInput_Non_Contract 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUI.Button btnInput_Non_Contract;
+
///
/// btnInput 控件。
///
diff --git a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx
index 2eb4bff..644bd33 100644
--- a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx
+++ b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx
@@ -63,6 +63,12 @@
+
+
+
+
+
+
diff --git a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.cs b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.cs
index f57e12f..28596fc 100644
--- a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.cs
+++ b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.cs
@@ -14,6 +14,7 @@ using CK.SCP.Models.ScpEntity.ExcelImportEntity;
using CK.SCP.Models.Enums;
using CK.SCP.Common;
using System.Text;
+using CK.SCP.Models.ScpEntity.ExcelExportEnttity;
namespace SCP.PlanData
{
@@ -242,6 +243,64 @@ namespace SCP.PlanData
}
});
}
-
+
+ protected void btnInput_Click_Contract(object sender, EventArgs e)
+ {
+ Excel_Input(BillModType.Contract);
+ }
+ protected void btnInput_Click_Non_Contract(object sender, EventArgs e)
+ {
+ Excel_Input(BillModType.Non_Contract);
+ }
+ protected void Excel_Input(BillModType p_modtype)
+ {
+ ResultObject saveret = new ResultObject();
+ string _fileName = FileUp.FileName;
+ if (string.IsNullOrEmpty(_fileName))
+ {
+ Alert.Show("选择文件为空!");
+ return;
+ }
+ string _lx = _fileName.Split('.')[1];
+ Stream _stream = FileUp.PostedFile.InputStream;
+ DataTable _dt = new DataTable();
+ if (_lx == "xls")
+ {
+ _dt = ExcelHelper.GetDataTable(_stream);
+ }
+ else
+ {
+ _dt = ExcelHelper.GetDataTableOfXlsx(_stream);
+ }
+
+ var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList();
+ var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]);
+ if (checkret.State == ReturnStatus.Failed && checkret.Result == false)
+ {
+ Alert.Show(string.Join("
", checkret.MessageList));
+ return;
+ }
+ if (CurrentUser.ConfigList.ContainsKey("数据中心接口"))
+ {
+ saveret = SCP_DC_UNI_CONTROLLER.WritePo(list, CurrentUser.FactoryList[0], CurrentUser.Name, DateTime.Now, p_modtype, CurrentUser.SubSiteList[0], CurrentUser.ChineseName, CurrentUser.CellPhone);
+ }
+ else
+ {
+ saveret = SCP_PO_CONTROLLER.Save_EXCEL_PO_MOD(list, CurrentUser.FactoryList[0], CurrentUser.Name, DateTime.Now, p_modtype, CurrentUser.SubSiteList[0], CurrentUser.ChineseName, CurrentUser.CellPhone);
+ }
+ if (saveret.State == ReturnStatus.Succeed && saveret.Result == true)
+ {
+ BindOrder();
+ Alert.Show("订单编号" + saveret.Message + "导入成功!");
+ return;
+ }
+ else
+ {
+ //Alert.Show(string.Join("
", saveret.MessageList));
+ Alert.Show(saveret.Message);
+ return;
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.designer.cs b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.designer.cs
index 717dd56..a242ff3 100644
--- a/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.designer.cs
+++ b/SCP/Views/PlanData/SCP_PO_EXTEND.aspx.designer.cs
@@ -113,6 +113,33 @@ namespace SCP.PlanData
///
protected global::FineUI.RadioButtonList rblist;
+ ///
+ /// FileUp 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUI.FileUpload FileUp;
+
+ ///
+ /// btnInput_Contract 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUI.Button btnInput_Contract;
+
+ ///
+ /// btnInput_Non_Contract 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUI.Button btnInput_Non_Contract;
+
///
/// gp1 控件。
///