|
@ -66,24 +66,171 @@ namespace ICSSoft.FromERP |
|
|
result = client.CallZWMS_SK_DO_READ(Info); |
|
|
result = client.CallZWMS_SK_DO_READ(Info); |
|
|
List<SAPDispatchGetVPN.ZWMS_DO_ITEM> ItemInfoList = new List<SAPDispatchGetVPN.ZWMS_DO_ITEM>(); |
|
|
List<SAPDispatchGetVPN.ZWMS_DO_ITEM> ItemInfoList = new List<SAPDispatchGetVPN.ZWMS_DO_ITEM>(); |
|
|
ItemInfoList.AddRange(result.T_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) |
|
|
foreach (SAPDispatchGetVPN.ZWMS_DO_HEAD HeadInfo in result.T_HEAD) |
|
|
{ |
|
|
{ |
|
|
var ItemInfo = ItemInfoList.Where(a => a.VBELN == HeadInfo.VBELN); |
|
|
var ItemInfo = ItemInfoList.Where(a => a.VBELN == HeadInfo.VBELN); |
|
|
|
|
|
int LineNum = 10; |
|
|
foreach (SAPDispatchGetVPN.ZWMS_DO_ITEM Item in ItemInfo) |
|
|
foreach (SAPDispatchGetVPN.ZWMS_DO_ITEM Item in ItemInfo) |
|
|
|
|
|
{ |
|
|
|
|
|
if (Item.SERAIL != "ZS01") |
|
|
|
|
|
{ |
|
|
|
|
|
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 |
|
|
|
|
|
{ |
|
|
|
|
|
var SubLineInfo = SubLineInfoList.Where(a => a.VBELN == Item.VBELN); |
|
|
|
|
|
foreach (SAPDispatchGetVPN.ZWMS_DO_GERNR SubInfo in SubLineInfo) |
|
|
{ |
|
|
{ |
|
|
string ExtensionID = ""; |
|
|
string ExtensionID = ""; |
|
|
bool isNew = false; |
|
|
bool isNew = false; |
|
|
string Colspan = Item.KDAUF + "~" + Item.SERAIL + "~~" + Item.KDPOS + "~~~~~~~~~~"; |
|
|
|
|
|
|
|
|
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); |
|
|
var Extensionline = db.ICSExtension.SingleOrDefault(a => a.Colspan == Colspan); |
|
|
if (Extensionline == null) |
|
|
if (Extensionline == null) |
|
|
{ |
|
|
{ |
|
|
ExtensionID = AppConfig.GetGuid(); |
|
|
ExtensionID = AppConfig.GetGuid(); |
|
|
Extensionline = new ICSExtension(); |
|
|
Extensionline = new ICSExtension(); |
|
|
Extensionline.ID = ExtensionID; |
|
|
Extensionline.ID = ExtensionID; |
|
|
Extensionline.BatchCode = Item.SERAIL; |
|
|
|
|
|
|
|
|
if (Item.SOBKZ == "E") |
|
|
|
|
|
{ |
|
|
|
|
|
Extensionline.BatchCode = SubInfo.GERNR; |
|
|
Extensionline.Version = ""; |
|
|
Extensionline.Version = ""; |
|
|
Extensionline.Brand = Item.KDPOS; |
|
|
Extensionline.Brand = Item.KDPOS; |
|
|
Extensionline.ProjectCode = Item.KDAUF; |
|
|
Extensionline.ProjectCode = Item.KDAUF; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Extensionline.BatchCode = SubInfo.GERNR; |
|
|
|
|
|
Extensionline.Version = ""; |
|
|
|
|
|
Extensionline.Brand = "000000"; |
|
|
|
|
|
Extensionline.ProjectCode = ""; |
|
|
|
|
|
} |
|
|
Extensionline.cFree1 = ""; |
|
|
Extensionline.cFree1 = ""; |
|
|
Extensionline.cFree2 = ""; |
|
|
Extensionline.cFree2 = ""; |
|
|
Extensionline.cFree3 = ""; |
|
|
Extensionline.cFree3 = ""; |
|
@ -116,7 +263,8 @@ namespace ICSSoft.FromERP |
|
|
rcvline.ID = AppConfig.GetGuid(); |
|
|
rcvline.ID = AppConfig.GetGuid(); |
|
|
rcvline.SDNQuantity = 0; |
|
|
rcvline.SDNQuantity = 0; |
|
|
rcvline.SDNCode = Item.VBELN;//销售出/退货单(交货单)
|
|
|
rcvline.SDNCode = Item.VBELN;//销售出/退货单(交货单)
|
|
|
rcvline.Sequence = Item.POSNR;//行号
|
|
|
|
|
|
|
|
|
rcvline.Sequence = LineNum.ToString();//行号
|
|
|
|
|
|
rcvline.SAPSequence = Item.POSNR; |
|
|
rcvline.InvCode = Item.MATNR;//物料编码
|
|
|
rcvline.InvCode = Item.MATNR;//物料编码
|
|
|
rcvline.SOCode = Item.KDAUF;//销售订单
|
|
|
rcvline.SOCode = Item.KDAUF;//销售订单
|
|
|
rcvline.SOSequence = Item.KDPOS;//销售订单行号
|
|
|
rcvline.SOSequence = Item.KDPOS;//销售订单行号
|
|
@ -169,6 +317,11 @@ namespace ICSSoft.FromERP |
|
|
db.ICSSDN.InsertOnSubmit(rcvline); |
|
|
db.ICSSDN.InsertOnSubmit(rcvline); |
|
|
} |
|
|
} |
|
|
db.SubmitChanges(); |
|
|
db.SubmitChanges(); |
|
|
|
|
|
LineNum += 10; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|