Browse Source

调整销售发货退货的三层结构

master
lilili 2 years ago
parent
commit
b0e7a5dd73
  1. 1
      ICSSoft.FromERP/ICSSoft.Frame.Data.Entity/Fram.dbml
  2. 24
      ICSSoft.FromERP/ICSSoft.Frame.Data.Entity/Fram.designer.cs
  3. 335
      ICSSoft.FromERP/ICSSoft.FromERP/ICSDispatchDoc.cs

1
ICSSoft.FromERP/ICSSoft.Frame.Data.Entity/Fram.dbml

@ -285,6 +285,7 @@
<Column Name="SalesUnit" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
<Column Name="StockIndicator" Type="System.String" DbType="NVarChar(1)" CanBeNull="true" />
<Column Name="IsSerialNumber" Type="System.String" DbType="NVarChar(4)" CanBeNull="true" />
<Column Name="SAPSequence" Type="System.String" DbType="VarChar(50)" CanBeNull="true" />
</Type>
</Table>
<Table Name="dbo.ICSInventoryLotDetail" Member="ICSInventoryLotDetail">

24
ICSSoft.FromERP/ICSSoft.Frame.Data.Entity/Fram.designer.cs

@ -5880,6 +5880,8 @@ namespace ICSSoft.Frame.Data.Entity
private string _IsSerialNumber;
private string _SAPSequence;
#region 可扩展性方法定义
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
@ -5950,6 +5952,8 @@ namespace ICSSoft.Frame.Data.Entity
partial void OnStockIndicatorChanged();
partial void OnIsSerialNumberChanging(string value);
partial void OnIsSerialNumberChanged();
partial void OnSAPSequenceChanging(string value);
partial void OnSAPSequenceChanged();
#endregion
public ICSSDN()
@ -6617,6 +6621,26 @@ namespace ICSSoft.Frame.Data.Entity
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SAPSequence", DbType="VarChar(50)")]
public string SAPSequence
{
get
{
return this._SAPSequence;
}
set
{
if ((this._SAPSequence != value))
{
this.OnSAPSequenceChanging(value);
this.SendPropertyChanging();
this._SAPSequence = value;
this.SendPropertyChanged("SAPSequence");
this.OnSAPSequenceChanged();
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;

335
ICSSoft.FromERP/ICSSoft.FromERP/ICSDispatchDoc.cs

@ -66,109 +66,262 @@ namespace ICSSoft.FromERP
result = client.CallZWMS_SK_DO_READ(Info);
List<SAPDispatchGetVPN.ZWMS_DO_ITEM> ItemInfoList = new List<SAPDispatchGetVPN.ZWMS_DO_ITEM>();
ItemInfoList.AddRange(result.T_ITEM);
List<SAPDispatchGetVPN.ZWMS_DO_GERNR> SubLineInfoList = new List<SAPDispatchGetVPN.ZWMS_DO_GERNR>();
SubLineInfoList.AddRange(result.T_GERNR);
foreach (SAPDispatchGetVPN.ZWMS_DO_HEAD HeadInfo in result.T_HEAD)
{
var ItemInfo = ItemInfoList.Where(a => a.VBELN == HeadInfo.VBELN);
int LineNum = 10;
foreach (SAPDispatchGetVPN.ZWMS_DO_ITEM Item in ItemInfo)
{
string ExtensionID = "";
bool isNew = false;
string Colspan = Item.KDAUF + "~" + Item.SERAIL + "~~" + Item.KDPOS + "~~~~~~~~~~";
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan);
if (Extensionline == null)
if (Item.SERAIL != "ZS01")
{
ExtensionID = AppConfig.GetGuid();
Extensionline = new ICSExtension();
Extensionline.ID = ExtensionID;
Extensionline.BatchCode = Item.SERAIL;
Extensionline.Version = "";
Extensionline.Brand = Item.KDPOS;
Extensionline.ProjectCode = Item.KDAUF;
Extensionline.cFree1 = "";
Extensionline.cFree2 = "";
Extensionline.cFree3 = "";
Extensionline.cFree4 = "";
Extensionline.cFree5 = "";
Extensionline.cFree6 = "";
Extensionline.cFree7 = "";
Extensionline.cFree8 = "";
Extensionline.cFree9 = "";
Extensionline.cFree10 = "";
Extensionline.Colspan = Colspan;
Extensionline.MTIME = DateTime.Now;
Extensionline.MUSER = "JOB";
Extensionline.MUSERName = "JOB";
Extensionline.WorkPoint = Item.WERKS;
db.ICSExtension.InsertOnSubmit(Extensionline);
string ExtensionID = "";
bool isNew = false;
string Colspan = "";
if (Item.SOBKZ == "E")
{
Colspan = Item.KDAUF + "~~~~" + Item.KDPOS + "~~~~~~~~~~";
}
else
{
Colspan = "~~~~~000000~~~~~~~~~~";
}
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan);
if (Extensionline == null)
{
ExtensionID = AppConfig.GetGuid();
Extensionline = new ICSExtension();
Extensionline.ID = ExtensionID;
if (Item.SOBKZ == "E")
{
Extensionline.BatchCode = "";
Extensionline.Version = "";
Extensionline.Brand = Item.KDPOS;
Extensionline.ProjectCode = Item.KDAUF;
}
else
{
Extensionline.BatchCode = "";
Extensionline.Version = "";
Extensionline.Brand = "000000";
Extensionline.ProjectCode = "";
}
Extensionline.cFree1 = "";
Extensionline.cFree2 = "";
Extensionline.cFree3 = "";
Extensionline.cFree4 = "";
Extensionline.cFree5 = "";
Extensionline.cFree6 = "";
Extensionline.cFree7 = "";
Extensionline.cFree8 = "";
Extensionline.cFree9 = "";
Extensionline.cFree10 = "";
Extensionline.Colspan = Colspan;
Extensionline.MTIME = DateTime.Now;
Extensionline.MUSER = "JOB";
Extensionline.MUSERName = "JOB";
Extensionline.WorkPoint = Item.WERKS;
db.ICSExtension.InsertOnSubmit(Extensionline);
db.SubmitChanges();
}
else
{
ExtensionID = Extensionline.ID;
}
var rcvline = db.ICSSDN.SingleOrDefault(a => a.SDNCode == Item.VBELN && a.Sequence == Item.POSNR && a.WorkPoint == Item.WERKS);
if (rcvline == null)
{
isNew = true;
rcvline = new Frame.Data.Entity.ICSSDN();
rcvline.ID = AppConfig.GetGuid();
rcvline.SDNQuantity = 0;
rcvline.SDNCode = Item.VBELN;//销售出/退货单(交货单)
rcvline.Sequence = LineNum.ToString();//行号
rcvline.SAPSequence = Item.POSNR;
rcvline.InvCode = Item.MATNR;//物料编码
rcvline.SOCode = Item.KDAUF;//销售订单
rcvline.SOSequence = Item.KDPOS;//销售订单行号
}
rcvline.CusCode = HeadInfo.KUNNR;//送达方
rcvline.CusName = HeadInfo.NAME1;//送达方名称
rcvline.ArriveDate = Convert.ToDateTime(HeadInfo.LFDAT);//交货日期
rcvline.WHCode = Item.LGORT;//仓库
if (HeadInfo.LFART == "LF" || HeadInfo.LFART == "ZLF" || HeadInfo.LFART == "ZYB1")
{
rcvline.Type = "1";
}
else
{
rcvline.Type = "2";
}
rcvline.Quantity = Item.LFIMG;//数量
rcvline.Amount = 0;
rcvline.CreatePerson = "JOB";
rcvline.CreateDateTime = DateTime.Now;
rcvline.Status = "1";
rcvline.ExtensionID = ExtensionID;
rcvline.MUSER = "JOB";
rcvline.MUSERName = "JOB";
rcvline.MTIME = DateTime.Now;
rcvline.WorkPoint = Item.WERKS;//站点
//新增字段
//装运点
rcvline.Points = HeadInfo.VSTEL;
//交货类型
rcvline.DeliveryType = HeadInfo.LFART;
//交货描述
rcvline.DeliveryDescribe = HeadInfo.VTEXT;
//物料描述
rcvline.InvDescribe = Item.MAKTX;
//辅助描述
rcvline.OtherDescribe = Item.DESCR;
//销售单位
rcvline.SalesUnit = Item.VRKME;
//特殊库存标识
rcvline.StockIndicator = Item.SOBKZ;
//序列号参数
rcvline.IsSerialNumber = Item.SERAIL;
if (isNew == true)
{
db.ICSSDN.InsertOnSubmit(rcvline);
}
db.SubmitChanges();
LineNum += 10;
}
else
{
ExtensionID = Extensionline.ID;
}
var SubLineInfo = SubLineInfoList.Where(a => a.VBELN == Item.VBELN);
foreach (SAPDispatchGetVPN.ZWMS_DO_GERNR SubInfo in SubLineInfo)
{
string ExtensionID = "";
bool isNew = false;
string Colspan = "";
if (Item.SOBKZ == "E")
{
Colspan = Item.KDAUF + "~" + SubInfo.GERNR + "~~" + Item.KDPOS + "~~~~~~~~~~";
}
else
{
Colspan = "~~~~~000000~~~~~~~~~~";
}
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan);
if (Extensionline == null)
{
ExtensionID = AppConfig.GetGuid();
Extensionline = new ICSExtension();
Extensionline.ID = ExtensionID;
if (Item.SOBKZ == "E")
{
Extensionline.BatchCode = SubInfo.GERNR;
Extensionline.Version = "";
Extensionline.Brand = Item.KDPOS;
Extensionline.ProjectCode = Item.KDAUF;
}
else
{
Extensionline.BatchCode = SubInfo.GERNR;
Extensionline.Version = "";
Extensionline.Brand = "000000";
Extensionline.ProjectCode = "";
}
Extensionline.cFree1 = "";
Extensionline.cFree2 = "";
Extensionline.cFree3 = "";
Extensionline.cFree4 = "";
Extensionline.cFree5 = "";
Extensionline.cFree6 = "";
Extensionline.cFree7 = "";
Extensionline.cFree8 = "";
Extensionline.cFree9 = "";
Extensionline.cFree10 = "";
Extensionline.Colspan = Colspan;
Extensionline.MTIME = DateTime.Now;
Extensionline.MUSER = "JOB";
Extensionline.MUSERName = "JOB";
Extensionline.WorkPoint = Item.WERKS;
db.ICSExtension.InsertOnSubmit(Extensionline);
db.SubmitChanges();
}
else
{
ExtensionID = Extensionline.ID;
}
var rcvline = db.ICSSDN.SingleOrDefault(a => a.SDNCode == Item.VBELN && a.Sequence == Item.POSNR && a.WorkPoint == Item.WERKS);
if (rcvline == null)
{
isNew = true;
rcvline = new Frame.Data.Entity.ICSSDN();
rcvline.ID = AppConfig.GetGuid();
rcvline.SDNQuantity = 0;
rcvline.SDNCode = Item.VBELN;//销售出/退货单(交货单)
rcvline.Sequence = LineNum.ToString();//行号
rcvline.SAPSequence = Item.POSNR;
rcvline.InvCode = Item.MATNR;//物料编码
rcvline.SOCode = Item.KDAUF;//销售订单
rcvline.SOSequence = Item.KDPOS;//销售订单行号
}
rcvline.CusCode = HeadInfo.KUNNR;//送达方
rcvline.CusName = HeadInfo.NAME1;//送达方名称
rcvline.ArriveDate = Convert.ToDateTime(HeadInfo.LFDAT);//交货日期
rcvline.WHCode = Item.LGORT;//仓库
if (HeadInfo.LFART == "LF" || HeadInfo.LFART == "ZLF" || HeadInfo.LFART == "ZYB1")
{
rcvline.Type = "1";
}
else
{
rcvline.Type = "2";
}
rcvline.Quantity = Item.LFIMG;//数量
rcvline.Amount = 0;
rcvline.CreatePerson = "JOB";
rcvline.CreateDateTime = DateTime.Now;
rcvline.Status = "1";
rcvline.ExtensionID = ExtensionID;
rcvline.MUSER = "JOB";
rcvline.MUSERName = "JOB";
rcvline.MTIME = DateTime.Now;
rcvline.WorkPoint = Item.WERKS;//站点
//新增字段
//装运点
rcvline.Points = HeadInfo.VSTEL;
//交货类型
rcvline.DeliveryType = HeadInfo.LFART;
//交货描述
rcvline.DeliveryDescribe = HeadInfo.VTEXT;
//物料描述
rcvline.InvDescribe = Item.MAKTX;
//辅助描述
rcvline.OtherDescribe = Item.DESCR;
//销售单位
rcvline.SalesUnit = Item.VRKME;
//特殊库存标识
rcvline.StockIndicator = Item.SOBKZ;
//序列号参数
rcvline.IsSerialNumber = Item.SERAIL;
if (isNew == true)
{
db.ICSSDN.InsertOnSubmit(rcvline);
}
db.SubmitChanges();
LineNum += 10;
}
var rcvline = db.ICSSDN.SingleOrDefault(a => a.SDNCode == Item.VBELN && a.Sequence == Item.POSNR && a.WorkPoint == Item.WERKS);
if (rcvline == null)
{
isNew = true;
rcvline = new Frame.Data.Entity.ICSSDN();
rcvline.ID = AppConfig.GetGuid();
rcvline.SDNQuantity = 0;
rcvline.SDNCode = Item.VBELN;//销售出/退货单(交货单)
rcvline.Sequence = Item.POSNR;//行号
rcvline.InvCode = Item.MATNR;//物料编码
rcvline.SOCode = Item.KDAUF;//销售订单
rcvline.SOSequence = Item.KDPOS;//销售订单行号
}
rcvline.CusCode = HeadInfo.KUNNR;//送达方
rcvline.CusName = HeadInfo.NAME1;//送达方名称
rcvline.ArriveDate = Convert.ToDateTime(HeadInfo.LFDAT);//交货日期
rcvline.WHCode = Item.LGORT;//仓库
if (HeadInfo.LFART == "LF" || HeadInfo.LFART == "ZLF" || HeadInfo.LFART == "ZYB1")
{
rcvline.Type = "1";
}
else
{
rcvline.Type = "2";
}
rcvline.Quantity = Item.LFIMG;//数量
rcvline.Amount = 0;
rcvline.CreatePerson = "JOB";
rcvline.CreateDateTime = DateTime.Now;
rcvline.Status = "1";
rcvline.ExtensionID = ExtensionID;
rcvline.MUSER = "JOB";
rcvline.MUSERName = "JOB";
rcvline.MTIME = DateTime.Now;
rcvline.WorkPoint = Item.WERKS;//站点
//新增字段
//装运点
rcvline.Points = HeadInfo.VSTEL;
//交货类型
rcvline.DeliveryType = HeadInfo.LFART;
//交货描述
rcvline.DeliveryDescribe = HeadInfo.VTEXT;
//物料描述
rcvline.InvDescribe = Item.MAKTX;
//辅助描述
rcvline.OtherDescribe = Item.DESCR;
//销售单位
rcvline.SalesUnit = Item.VRKME;
//特殊库存标识
rcvline.StockIndicator = Item.SOBKZ;
//序列号参数
rcvline.IsSerialNumber = Item.SERAIL;
if (isNew == true)
{
db.ICSSDN.InsertOnSubmit(rcvline);
}
db.SubmitChanges();
}
}
}

Loading…
Cancel
Save