From 67d058167426f7f77631d21f49ddd0c34a931f29 Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 15 Mar 2021 15:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=90=E6=96=99=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.BLL/Store/SotreIn.cs | 2 +- NX.ERP.BLL/Store/SotreOut.cs | 2 +- NX.ERP.Model/Response/MOM/MoAllocate.cs | 3 ++ NX.ERP.Model/Response/MOM/MomDetail.cs | 11 ++--- NX.ERP.Model/Response/MOM/MomOrder.cs | 7 ++++ NX.ERP.Model/Response/Purchase/Arrival.cs | 10 +++++ NX.ERP.U8/Mom/MomOrderDAL.cs | 6 ++- NX.ERP.U8/Purchase/ArrivalDAL.cs | 2 +- NX.ERP.U8/Store/MaterielStoreOutDAL.cs | 49 ++++++++++++++++++++--- NX.ERP.U8/Store/PuStoreInDAL.cs | 34 ++++++++++++++-- NX.ERP.U8/Store/SaleOutDAL.cs | 30 ++++++++++++-- 11 files changed, 135 insertions(+), 21 deletions(-) diff --git a/NX.ERP.BLL/Store/SotreIn.cs b/NX.ERP.BLL/Store/SotreIn.cs index 16ed8ca..729e39c 100644 --- a/NX.ERP.BLL/Store/SotreIn.cs +++ b/NX.ERP.BLL/Store/SotreIn.cs @@ -16,7 +16,7 @@ namespace NX.ERP.BLL.Store if (inbound.InboundType == Model.InboundType.PurchaseIn) { var dal = new NX.ERP.U8.Store.PuStoreInDAL(); - ID = dal.AddVocher(new ERP.Model.Request.PuStoreIn() + ID = dal.SaveVoucher(new ERP.Model.Request.PuStoreIn() { Id = inbound.Id, Code = inbound.InboundNo, diff --git a/NX.ERP.BLL/Store/SotreOut.cs b/NX.ERP.BLL/Store/SotreOut.cs index 2abc9ff..f7830b3 100644 --- a/NX.ERP.BLL/Store/SotreOut.cs +++ b/NX.ERP.BLL/Store/SotreOut.cs @@ -15,7 +15,7 @@ namespace NX.ERP.BLL.Store if (outBound.OutboundType == Model.OutBoundType.MaterialOut) { var dal = new U8.Store.MaterialStoreOutDAL(); - ID = dal.AddVocher(new ERP.Model.Request.MaterialStoreOut() + ID = dal.SaveVoucher(new ERP.Model.Request.MaterialStoreOut() { Id = outBound.Id, Code = outBound.OutboundNo, diff --git a/NX.ERP.Model/Response/MOM/MoAllocate.cs b/NX.ERP.Model/Response/MOM/MoAllocate.cs index d82f6d6..1f9660e 100644 --- a/NX.ERP.Model/Response/MOM/MoAllocate.cs +++ b/NX.ERP.Model/Response/MOM/MoAllocate.cs @@ -21,5 +21,8 @@ namespace NX.ERP.Model.MOM //public string UnitCode { get; set; } public double Issqty { get; set; } + [Newtonsoft.Json.JsonIgnore] + + public MomDetail momDetail { get; set; } } } diff --git a/NX.ERP.Model/Response/MOM/MomDetail.cs b/NX.ERP.Model/Response/MOM/MomDetail.cs index 5c89aec..23f51ca 100644 --- a/NX.ERP.Model/Response/MOM/MomDetail.cs +++ b/NX.ERP.Model/Response/MOM/MomDetail.cs @@ -7,7 +7,7 @@ using System.Text; namespace NX.ERP.Model.MOM { - public class MomDetail: BaseModel + public class MomDetail : BaseModel { private int id; private double qty; @@ -20,17 +20,18 @@ namespace NX.ERP.Model.MOM public string ProductOrderNo { get; set; } - public DateTime ProductOrderDate { get; set; } + public DateTime ProductOrderDate { get; set; } public string ProductCode { get; set; } - + [Newtonsoft.Json.JsonIgnore] + public string MDeptCode { get; set; } //public string BatchNo { get; set; } - + public double Qty { get => qty; set => qty = value; } - + diff --git a/NX.ERP.Model/Response/MOM/MomOrder.cs b/NX.ERP.Model/Response/MOM/MomOrder.cs index 67a1de7..8d6ba7c 100644 --- a/NX.ERP.Model/Response/MOM/MomOrder.cs +++ b/NX.ERP.Model/Response/MOM/MomOrder.cs @@ -23,6 +23,13 @@ namespace NX.ERP.Model.MOM public string PreparedBy { get; set; } [Newtonsoft.Json.JsonIgnore] public ICollection Allocates { get; set; } = new List(); + + + + + + + } diff --git a/NX.ERP.Model/Response/Purchase/Arrival.cs b/NX.ERP.Model/Response/Purchase/Arrival.cs index 6902fc8..f7c4801 100644 --- a/NX.ERP.Model/Response/Purchase/Arrival.cs +++ b/NX.ERP.Model/Response/Purchase/Arrival.cs @@ -33,6 +33,16 @@ namespace NX.ERP.Model.Purchase public string PTCode { get; set; } [Newtonsoft.Json.JsonIgnore] public string BusType { get; set; } + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + public string CPersonCode { get; set; } + /// + /// + /// + [Newtonsoft.Json.JsonIgnore] + public string cpersonname { get; set; } } } diff --git a/NX.ERP.U8/Mom/MomOrderDAL.cs b/NX.ERP.U8/Mom/MomOrderDAL.cs index c1a832f..59bcaef 100644 --- a/NX.ERP.U8/Mom/MomOrderDAL.cs +++ b/NX.ERP.U8/Mom/MomOrderDAL.cs @@ -19,7 +19,7 @@ namespace NX.ERP.U8.Mom { string strSQL = @"select a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.CreateDate as ProductDate,a.CreateUser as PreparedBy, - b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty, + b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,ISNULL( b.MDeptCode,'53') as MDeptCode,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty, c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty from mom_order as a left join mom_orderdetail as b on a.MoId=b.MoId @@ -46,6 +46,9 @@ namespace NX.ERP.U8.Mom if (!lookupDetail.TryGetValue(OrderDetail.ProductOrderDtlId, out var momDetail)) { lookupDetail.Add(OrderDetail.ProductOrderDtlId, OrderDetail); + + + Order.ProductDtlLst.Add(OrderDetail); } else @@ -54,6 +57,7 @@ namespace NX.ERP.U8.Mom } Order.Allocates.Add(MoAllocate); OrderDetail.ProductAllocateOrderLst.Add(MoAllocate); + MoAllocate.momDetail = OrderDetail; return Order; }, param, null, true, "id", 10, System.Data.CommandType.Text); return lookupOrder.Values; diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 1ab4ed7..f2dcecb 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -11,7 +11,7 @@ namespace NX.ERP.U8.Purchase { using (var conn = U8LoginContext.Instance.Connection) { - string strSQL = @"select a.id AS ArrivalId,a.cCode as ArrivalCode,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as ArrivalDate,A.cVenCode AS SupplierCode, + string strSQL = @"select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as ArrivalDate,A.cVenCode AS SupplierCode, B.Autoid as id,b.ID as ArrivalID, b.cInvCode AS MaterialCode, b.cBatch AS BatchNo, diff --git a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs index 23dfffe..8a576a4 100644 --- a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs +++ b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs @@ -46,9 +46,9 @@ namespace NX.ERP.U8.Store headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0412")); headXml.setAttribute("editprop", "A"); - headXml.setAttribute("cdepcode", "1"); + //headXml.setAttribute("cdepcode", "1"); headXml.setAttribute("crdcode", "201"); - headXml.setAttribute("cpersoncode", "it"); + headXml.setAttribute("cwhcode", storeOut.Whcode); headXml.setAttribute("csource", storeOut.Source); if (storeOut.Source == "生产订单") @@ -64,7 +64,9 @@ namespace NX.ERP.U8.Store string lastProductNo = null; headXml.setAttribute("crdname", "材料出库"); - headXml.setAttribute("cdepcode", "24"); + //headXml.setAttribute("cdepcode", "24"); + + //headXml.setAttribute("cdepname", "研发LA组"); IXMLDOMElement bodyXml; for (var n = 0; n < storeOut.Details.Count(); n++) @@ -77,6 +79,9 @@ namespace NX.ERP.U8.Store } + + + if (alllocate.MaterialCode != detail.InvCode) { throw new Exception($"订单明细存货编号与出库存货编号不符:{detail.InvCode}"); @@ -90,6 +95,12 @@ namespace NX.ERP.U8.Store { lastProductNo = ""; } + + + headXml.setAttribute("cdepcode", alllocate.momDetail.MDeptCode); + + + #region 明细 bodyXml = domBody.createElement("z:row"); @@ -139,11 +150,37 @@ namespace NX.ERP.U8.Store } - - public bool UpdateVocher(Model.Request.MaterialStoreOut storeOut) + public string SaveVoucher(Model.Request.MaterialStoreOut storeOut) { - VoucherParameter voucherParameter = this.LoadVoucher($"Id='{storeOut.Id}'"); + var voucherParameter = this.LoadVoucher($"id='{storeOut.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVocher(storeOut); + } + else + { + if (this.UpdateVocher(storeOut, voucherParameter)) + { + return storeOut.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } + } + + + } + + + public bool UpdateVocher(Model.Request.MaterialStoreOut storeOut, VoucherParameter voucherParameter = null) + { + if (voucherParameter == null) + { + + voucherParameter = this.LoadVoucher($"Id='{storeOut.Id}'"); + } DOMDocument domBody = voucherParameter.DomBody; if (storeOut.Source == "生产订单") { diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs index 34d13ad..5cb3944 100644 --- a/NX.ERP.U8/Store/PuStoreInDAL.cs +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -50,7 +50,7 @@ namespace NX.ERP.U8.Store headXml.setAttribute("vt_id", new VT().GetDefaltVTID("24")); headXml.setAttribute("editprop", "A"); headXml.setAttribute("cdepcode", puStoreIn.Deptcode); - headXml.setAttribute("cpersoncode", puStoreIn.PersonCode); + headXml.setAttribute("crdcode", "101" /*puStoreIn.RdCode*/); headXml.setAttribute("cwhcode", puStoreIn.Whcode); headXml.setAttribute("bisstqc", "0"); @@ -70,6 +70,8 @@ namespace NX.ERP.U8.Store headXml.setAttribute("darvdate", Arrival.ArrivalDate); headXml.setAttribute("itaxrate", Arrival.TaxRate); headXml.setAttribute("cptcode", Arrival.PTCode); + headXml.setAttribute("cpersoncode", Arrival.CPersonCode); + headXml.setAttribute("cpersonname", Arrival.cpersonname); IXMLDOMElement bodyXml; for (var n = 0; n < puStoreIn.Details.Count; n++) { @@ -134,13 +136,39 @@ namespace NX.ERP.U8.Store + public string SaveVoucher(Model.Request.PuStoreIn puStoreIn) + { + var voucherParameter = this.LoadVoucher($"id='{puStoreIn.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVocher(puStoreIn); + } + else + { + if (this.UpdateVocher(puStoreIn, voucherParameter)) + { + return puStoreIn.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } + + } - public bool UpdateVocher(Model.Request.PuStoreIn puStoreIn) + } + + + + public bool UpdateVocher(Model.Request.PuStoreIn puStoreIn, VoucherParameter voucherParameter = null) { try { - var voucherParameter = this.LoadVoucher($"id='{puStoreIn.Id}'"); + if (voucherParameter == null) + { + voucherParameter = this.LoadVoucher($"id='{puStoreIn.Id}'"); + } //添加一條 DOMDocument domBody = voucherParameter.DomBody; if (puStoreIn.Source == "采购到货单") diff --git a/NX.ERP.U8/Store/SaleOutDAL.cs b/NX.ERP.U8/Store/SaleOutDAL.cs index cc64ea3..5646261 100644 --- a/NX.ERP.U8/Store/SaleOutDAL.cs +++ b/NX.ERP.U8/Store/SaleOutDAL.cs @@ -99,16 +99,40 @@ namespace NX.ERP.U8.Store } - public bool UpdateVoucher(SaleStoreOut storeOut) + + public string SaveVoucher(SaleStoreOut storeOut) { + var voucherParameter = this.LoadVoucher($"id='{storeOut.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVoucher(storeOut); + } + else + { + if (this.UpdateVoucher(storeOut, voucherParameter)) + { + return storeOut.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } - VoucherParameter voucherParameter = this.LoadVoucher($"id='{storeOut.Id}'"); + } + + + } + public bool UpdateVoucher(SaleStoreOut storeOut, VoucherParameter voucherParameter = null) + { + if (voucherParameter == null) + { + voucherParameter = this.LoadVoucher($"id='{storeOut.Id}'"); + } DOMDocument domBody = voucherParameter.DomBody; IXMLDOMElement bodyXml; - if (storeOut.Source == "发货单") { var dispatch = new Sale.DispatchListDAL().GetModel(storeOut.SourceCode);