材料出库
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@ namespace NX.ERP.Model.MOM
|
||||
public string PreparedBy { get; set; }
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public ICollection<MoAllocate> Allocates { get; set; } = new List<MoAllocate>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,16 @@ namespace NX.ERP.Model.Purchase
|
||||
public string PTCode { get; set; }
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public string BusType { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public string CPersonCode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public string cpersonname { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 == "生产订单")
|
||||
{
|
||||
|
||||
@@ -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 == "采购到货单")
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user