diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index c9ead36..efb09d0 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -60,6 +60,10 @@ + + + + diff --git a/NX.ERP.Model/Request/MaterielStoreOutDetail.cs b/NX.ERP.Model/Request/MaterielStoreOutDetail.cs index d18e4a4..3e495cf 100644 --- a/NX.ERP.Model/Request/MaterielStoreOutDetail.cs +++ b/NX.ERP.Model/Request/MaterielStoreOutDetail.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace NX.ERP.Model.Store +namespace NX.ERP.Model.Request { public class MaterielStoreOutDetail { @@ -11,11 +11,11 @@ namespace NX.ERP.Model.Store private double quantity; private string binCode; private string cinvcode; - public int sorceDetailId { get; set; } - - + public int SorceDetailId { get; set; } + + public double Quantity { get => quantity; set => quantity = value; } - public string BinCode { get => binCode; set => binCode = value; } - public string Cinvcode { get => cinvcode; set => cinvcode = value; } + public string Position { get => binCode; set => binCode = value; } + public string InvCode { get => cinvcode; set => cinvcode = value; } } } diff --git a/NX.ERP.Model/Request/OtherStoreIn.cs b/NX.ERP.Model/Request/OtherStoreIn.cs new file mode 100644 index 0000000..fb4f8fa --- /dev/null +++ b/NX.ERP.Model/Request/OtherStoreIn.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class OtherStoreInOut + { + public string Code { get; set; } + public DateTime Date { get; set; } + public string WhCode { get; set; } + public IList details = new List(); + } +} diff --git a/NX.ERP.Model/Request/OtherStoreInDetail.cs b/NX.ERP.Model/Request/OtherStoreInDetail.cs new file mode 100644 index 0000000..61c84e6 --- /dev/null +++ b/NX.ERP.Model/Request/OtherStoreInDetail.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class OtherStoreInOutDetail + { + public string InvCode { get; set; } + public double Quantity { get; set; } + public string Position { get; set; } + } + +} diff --git a/NX.ERP.Model/Request/OtherStoreOut.cs b/NX.ERP.Model/Request/OtherStoreOut.cs new file mode 100644 index 0000000..fd15cb8 --- /dev/null +++ b/NX.ERP.Model/Request/OtherStoreOut.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class OtherStoreOut + { + public ICollection details = new List(); + } +} diff --git a/NX.ERP.Model/Request/OtherStoreOutDetail.cs b/NX.ERP.Model/Request/OtherStoreOutDetail.cs new file mode 100644 index 0000000..9e8acab --- /dev/null +++ b/NX.ERP.Model/Request/OtherStoreOutDetail.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class OtherStoreOutDetail + { + } +} diff --git a/NX.ERP.Model/Response/Base/Bin.cs b/NX.ERP.Model/Response/Base/Bin.cs index 7e5aa52..a0eb51d 100644 --- a/NX.ERP.Model/Response/Base/Bin.cs +++ b/NX.ERP.Model/Response/Base/Bin.cs @@ -17,11 +17,11 @@ namespace NX.ERP.Model private string _cMemo; private string _cBarCode; - public string BinCode { get => _BinCode; set => _BinCode = value; } - public string BinName { get => _BinName; set => _BinName = value; } + public string Code { get => _BinCode; set => _BinCode = value; } + public string Name { get => _BinName; set => _BinName = value; } public string IsPosGrade { get => _IsPosGrade; set => _IsPosGrade = value; } public bool BPosEnd { get => _bPosEnd; set => _bPosEnd = value; } - public string WarehouseCode { get => _WarehouseCode; set => _WarehouseCode = value; } + public string WhCode { get => _WarehouseCode; set => _WarehouseCode = value; } public int VolumeLimit { get => _VolumeLimit; set => _VolumeLimit = value; } public int WeightLimit { get => _WeightLimit; set => _WeightLimit = value; } public string CMemo { get => _cMemo; set => _cMemo = value; } diff --git a/NX.ERP.Model/Response/Base/Materiel.cs b/NX.ERP.Model/Response/Base/Materiel.cs index 4f64145..174bbfb 100644 --- a/NX.ERP.Model/Response/Base/Materiel.cs +++ b/NX.ERP.Model/Response/Base/Materiel.cs @@ -7,8 +7,8 @@ namespace NX.ERP.Model { public class Materiel { - private string materielCode; - private string materielName; + private string _code; + private string _name; private decimal length; private decimal wide; private decimal height; @@ -21,8 +21,8 @@ namespace NX.ERP.Model private int minStock; private int aql; private int invccode; - public string MaterielCode { get => materielCode; set => materielCode = value; } - public string MaterielName { get => materielName; set => materielName = value; } + public string Code { get => _code; set => _code = value; } + public string Name { get => _name; set => _name = value; } public decimal Length { get => length; set => length = value; } public decimal Wide { get => wide; set => wide = value; } public decimal Height { get => height; set => height = value; } diff --git a/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs b/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs index 4ca517a..409efca 100644 --- a/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs +++ b/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace NX.ERP.Model.Request +namespace NX.ERP.Model.Store { public class MaterielStoreOutDetail { @@ -11,11 +11,11 @@ namespace NX.ERP.Model.Request private double quantity; private string binCode; private string cinvcode; - public int sorceDetailId { get; set; } - - + public int SorceDetailId { get; set; } + + public double Quantity { get => quantity; set => quantity = value; } public string Position { get => binCode; set => binCode = value; } - public string Cinvcode { get => cinvcode; set => cinvcode = value; } + public string InvCode { get => cinvcode; set => cinvcode = value; } } } diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index 82dc46c..474c59c 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -341,8 +341,8 @@ namespace U8AppMain new NX.ERP.Model.Request.MaterielStoreOutDetail() { Position="002070206", - Cinvcode="218174", - sorceDetailId=1000200145, + InvCode="218174", + SorceDetailId=1000200145, Quantity=1, } } @@ -355,14 +355,14 @@ namespace U8AppMain private void 其他入库ToolStripMenuItem_Click(object sender, EventArgs e) { var a = new NX.ERP.U8.Store.OtherStoreInDAL(); - a.AddVocher(new NX.ERP.Model.Store.OtherStoreInOut() + a.AddVocher(new NX.ERP.Model.Request.OtherStoreInOut() { Date = DateTime.Today, Code = "111", WhCode = "2", - details = new List() + details = new List() { - new NX.ERP.Model.Store.OtherStoreInOutDetail() + new NX.ERP.Model.Request.OtherStoreInOutDetail() { InvCode="218174", Quantity=2, @@ -377,14 +377,14 @@ namespace U8AppMain private void 其他出库ToolStripMenuItem_Click(object sender, EventArgs e) { var a = new NX.ERP.U8.Store.OtherStoreOutDAL(); - a.AddVocher(new NX.ERP.Model.Store.OtherStoreInOut() + a.AddVocher(new NX.ERP.Model.Request.OtherStoreInOut() { Date = DateTime.Today, Code = "111", WhCode = "2", - details = new List() + details = new List() { - new NX.ERP.Model.Store.OtherStoreInOutDetail() + new NX.ERP.Model.Request.OtherStoreInOutDetail() { InvCode="218174", Quantity=4, diff --git a/NX.ERP.U8/Base/BinDAL.cs b/NX.ERP.U8/Base/BinDAL.cs index 7dbf0d7..419ee53 100644 --- a/NX.ERP.U8/Base/BinDAL.cs +++ b/NX.ERP.U8/Base/BinDAL.cs @@ -14,7 +14,7 @@ namespace NX.ERP.U8.Base { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { - var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode, + var sql = @"select cPosCode as Code,cPosName as Name,iPosGrade,bPosEnd,cWhCode as WhCode, iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode from Position"; if (!string.IsNullOrEmpty(strwhere)) { diff --git a/NX.ERP.U8/Base/MaterielDAL.cs b/NX.ERP.U8/Base/MaterielDAL.cs index acd700f..644f1e3 100644 --- a/NX.ERP.U8/Base/MaterielDAL.cs +++ b/NX.ERP.U8/Base/MaterielDAL.cs @@ -16,9 +16,9 @@ namespace NX.ERP.U8 using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { var sql = @"select - cInvCode AS MaterielCode , + cInvCode AS Code , cInvAddCode AS 存货代码, - cInvName AS MaterielName , + cInvName AS Name , fLength AS Length, fWidth AS Wide, fHeight AS Height, diff --git a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs index 05e8a61..07fe7ff 100644 --- a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs +++ b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs @@ -55,21 +55,37 @@ namespace NX.ERP.U8.Store { headXml.setAttribute("cbustype", "领料"); var Order = new Mom.MomOrderDAL().GetModel(storeOut.SourceCode); + if (Order == null) + { + throw new Exception($"未知订单:{storeOut.SourceCode}"); + } headXml.setAttribute("iproorderid", Order.Id); headXml.setAttribute("cmpocode", Order.Code); - headXml.setAttribute("cpspcode", "904008"); + headXml.setAttribute("cpspcode", ""); headXml.setAttribute("crdname", "材料出库"); headXml.setAttribute("cdepcode", "24"); - headXml.setAttribute("cdepname", "研发LA组"); + //headXml.setAttribute("cdepname", "研发LA组"); IXMLDOMElement bodyXml; for (var n = 0; n < storeOut.Details.Count(); n++) { var detail = storeOut.Details[n]; - var alllocate = Order.Allocates.First(m => { return m.Id == detail.sorceDetailId; }); - var moomDetail = Order.Details.First(m => { return m.Id == alllocate.ModId; }); + var alllocate = Order.Allocates.FirstOrDefault(m => { return m.Id == detail.SorceDetailId; }); + if (alllocate == null) + { + throw new Exception($"未知订单明细行:{detail.SorceDetailId}"); + + } + + if (alllocate.InvCode != detail.InvCode) + { + throw new Exception($"订单明细存货编号与出库存货编号不符:{detail.InvCode}"); + } + + + var moomDetail = Order.Details.FirstOrDefault(m => { return m.Id == alllocate.ModId; }); bodyXml = domBody.createElement("z:row"); bodyXml.setAttribute("autoid", n); - bodyXml.setAttribute("cinvcode", detail.Cinvcode); + bodyXml.setAttribute("cinvcode", detail.InvCode); bodyXml.setAttribute("iquantity", detail.Quantity); bodyXml.setAttribute("irowno", n + 1); bodyXml.setAttribute("cbatch", ""); @@ -80,7 +96,7 @@ namespace NX.ERP.U8.Store bodyXml.setAttribute("autoid", storeOut.Id); bodyXml.setAttribute("id", storeOut.Id); - bodyXml.setAttribute("impoids", detail.sorceDetailId); + bodyXml.setAttribute("impoids", detail.SorceDetailId); bodyXml.setAttribute("cmocode", Order.Code); bodyXml.setAttribute("invcode", "904008");//产品编码 bodyXml.setAttribute("cwhcode", storeOut.Whcode); diff --git a/NX.ERP.U8/Store/OtherStoreInDAL.cs b/NX.ERP.U8/Store/OtherStoreInDAL.cs index a8da272..eaf2857 100644 --- a/NX.ERP.U8/Store/OtherStoreInDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreInDAL.cs @@ -14,7 +14,7 @@ namespace NX.ERP.U8.Store } - public string AddVocher(Model.Store.OtherStoreInOut storeIn) + public string AddVocher(Model.Request.OtherStoreInOut storeIn) { VoucherParameter voucherParameter = new VoucherParameter diff --git a/NX.ERP.U8/Store/OtherStoreOutDAL.cs b/NX.ERP.U8/Store/OtherStoreOutDAL.cs index 28d68e1..a88db2f 100644 --- a/NX.ERP.U8/Store/OtherStoreOutDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreOutDAL.cs @@ -13,7 +13,7 @@ namespace NX.ERP.U8.Store } - public string AddVocher(Model.Store.OtherStoreInOut storeIn) + public string AddVocher(Model.Request.OtherStoreInOut storeIn) { VoucherParameter voucherParameter = new VoucherParameter @@ -85,7 +85,7 @@ namespace NX.ERP.U8.Store Console.WriteLine(str); try { - return AddRdVoucher( voucherParameter); + return AddRdVoucher(voucherParameter); } catch (Exception err) { diff --git a/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs b/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs index 9e878c9..6a7c74f 100644 --- a/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs @@ -8,8 +8,9 @@ namespace NX.ERP.WebAPi.Controllers.Store { public class OtherStoreInController:ApiController { + [Route("api/OtherIn/Add")] [HttpPost] - public string AddVoucher([FromBody] Model.Store.OtherStoreInOut storeIn) + public string AddVoucher([FromBody] Model.Request.OtherStoreInOut storeIn) { var dal = new NX.ERP.U8.Store.OtherStoreInDAL(); return dal.AddVocher(storeIn); diff --git a/NX.ERP.WebAPi/Controllers/Store/OtherStoreOutController.cs b/NX.ERP.WebAPi/Controllers/Store/OtherStoreOutController.cs index 42ac618..22c72e9 100644 --- a/NX.ERP.WebAPi/Controllers/Store/OtherStoreOutController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/OtherStoreOutController.cs @@ -8,8 +8,9 @@ namespace NX.ERP.WebAPi.Controllers.Store { public class OtherStoreOutController : ApiController { + [Route("api/OtherOut/Add")] [HttpPost] - public string AddVoucher([FromBody] Model.Store.OtherStoreInOut storeIn) + public string AddVoucher([FromBody] Model.Request.OtherStoreInOut storeIn) { var dal = new NX.ERP.U8.Store.OtherStoreOutDAL(); return dal.AddVocher(storeIn);