|
|
@ -89,131 +89,9 @@ namespace ICSSoft.FromERP |
|
|
|
int LineNum = 10; |
|
|
|
foreach (SAPDispatchGetZS.ZWMS_DO_ITEM Item in ItemInfo) |
|
|
|
{ |
|
|
|
if (Item.SERAIL != "ZS01") |
|
|
|
if (!string.IsNullOrWhiteSpace(Item.WERKS)) |
|
|
|
{ |
|
|
|
string ExtensionID = ""; |
|
|
|
bool isNew = false; |
|
|
|
string Colspan = ""; |
|
|
|
if (Item.SOBKZ == "E") |
|
|
|
{ |
|
|
|
Colspan = Item.KDAUF + "~~~" + Item.KDPOS + "~~~~~~~~~~"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Colspan = "~~~~~~~~~~~~~"; |
|
|
|
} |
|
|
|
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan&&a.WorkPoint== Item.WERKS); |
|
|
|
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 = ""; |
|
|
|
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.SAPSequence == Item.POSNR && a.ExtensionID == ExtensionID && 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.TrimStart('0');//物料编码
|
|
|
|
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.Trim();//仓库
|
|
|
|
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 |
|
|
|
{ |
|
|
|
var SubLineInfo = SubLineInfoList.Where(a => a.VBELN == Item.VBELN); |
|
|
|
if (SubLineInfo.Count() == 0) |
|
|
|
if (Item.SERAIL != "ZS01") |
|
|
|
{ |
|
|
|
string ExtensionID = ""; |
|
|
|
bool isNew = false; |
|
|
@ -226,7 +104,7 @@ namespace ICSSoft.FromERP |
|
|
|
{ |
|
|
|
Colspan = "~~~~~~~~~~~~~"; |
|
|
|
} |
|
|
|
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan); |
|
|
|
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan && a.WorkPoint == Item.WERKS); |
|
|
|
if (Extensionline == null) |
|
|
|
{ |
|
|
|
ExtensionID = AppConfig.GetGuid(); |
|
|
@ -336,18 +214,19 @@ namespace ICSSoft.FromERP |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
foreach (SAPDispatchGetZS.ZWMS_DO_GERNR SubInfo in SubLineInfo) |
|
|
|
var SubLineInfo = SubLineInfoList.Where(a => a.VBELN == Item.VBELN); |
|
|
|
if (SubLineInfo.Count() == 0) |
|
|
|
{ |
|
|
|
string ExtensionID = ""; |
|
|
|
bool isNew = false; |
|
|
|
string Colspan = ""; |
|
|
|
if (Item.SOBKZ == "E") |
|
|
|
{ |
|
|
|
Colspan = Item.KDAUF + "~" + SubInfo.GERNR + "~~" + Item.KDPOS + "~~~~~~~~~~"; |
|
|
|
Colspan = Item.KDAUF + "~~~" + Item.KDPOS + "~~~~~~~~~~"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Colspan = "~" + SubInfo.GERNR + "~~~~~~~~~~~~"; |
|
|
|
Colspan = "~~~~~~~~~~~~~"; |
|
|
|
} |
|
|
|
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan); |
|
|
|
if (Extensionline == null) |
|
|
@ -357,14 +236,14 @@ namespace ICSSoft.FromERP |
|
|
|
Extensionline.ID = ExtensionID; |
|
|
|
if (Item.SOBKZ == "E") |
|
|
|
{ |
|
|
|
Extensionline.BatchCode = SubInfo.GERNR; |
|
|
|
Extensionline.BatchCode = ""; |
|
|
|
Extensionline.Version = ""; |
|
|
|
Extensionline.Brand = Item.KDPOS; |
|
|
|
Extensionline.ProjectCode = Item.KDAUF; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Extensionline.BatchCode = SubInfo.GERNR; |
|
|
|
Extensionline.BatchCode = ""; |
|
|
|
Extensionline.Version = ""; |
|
|
|
Extensionline.Brand = ""; |
|
|
|
Extensionline.ProjectCode = ""; |
|
|
@ -457,9 +336,132 @@ namespace ICSSoft.FromERP |
|
|
|
db.SubmitChanges(); |
|
|
|
LineNum += 10; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
foreach (SAPDispatchGetZS.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 = "~" + SubInfo.GERNR + "~~~~~~~~~~~~"; |
|
|
|
} |
|
|
|
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 = ""; |
|
|
|
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.SAPSequence == Item.POSNR && a.ExtensionID == ExtensionID && 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.TrimStart('0');//物料编码
|
|
|
|
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.Trim();//仓库
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|