|
|
@ -3489,37 +3489,41 @@ namespace ICSSoft.DataProject |
|
|
|
/// <param name="TaskID"></param>
|
|
|
|
/// <param name="cmd"></param>
|
|
|
|
/// <param name="language"></param>
|
|
|
|
public static void ActionForkLiftTaskEnd(string TaskID, SqlCommand cmd, Dictionary<string, string> language) |
|
|
|
public static void ActionForkLiftTaskEnd(string TaskID, string TaskType, string DestBin, SqlCommand cmd, Dictionary<string, string> language) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
#region 获取任务ID相关的料架条码及目标库位信息
|
|
|
|
string ContainerCode = ""; |
|
|
|
string StartLocation = ""; |
|
|
|
string EndLocation = ""; |
|
|
|
string sql = @"select ContainerCode,StartLocation,EndLocation from ICSForkLiftTaskLog
|
|
|
|
where TaskCode='{0}'";
|
|
|
|
sql = string.Format(sql, TaskID); |
|
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
throw new Exception("任务ID:" + TaskID + ",未查询到相关任务记录,无法入库!"); |
|
|
|
} |
|
|
|
else |
|
|
|
if (TaskType == "PTWY上架") |
|
|
|
{ |
|
|
|
ContainerCode = dt.Rows[0]["ContainerCode"].ToString(); |
|
|
|
StartLocation = dt.Rows[0]["StartLocation"].ToString(); |
|
|
|
EndLocation = dt.Rows[0]["EndLocation"].ToString(); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
#region 入库
|
|
|
|
|
|
|
|
#region 根据条码获取入库单据信息
|
|
|
|
string chksql = @"select COUNT(B.LotNo) AS LotCount from ICSContainer A
|
|
|
|
#region 获取任务ID相关的料架条码及目标库位信息
|
|
|
|
string ContainerCode = ""; |
|
|
|
string StartLocation = ""; |
|
|
|
string EndLocation = ""; |
|
|
|
string sql = @"select ContainerCode,StartLocation,EndLocation from ICSForkLiftTaskLog
|
|
|
|
where TaskCode='{0}'";
|
|
|
|
sql = string.Format(sql, TaskID); |
|
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
throw new Exception("任务ID:" + TaskID + ",未查询到相关任务记录,无法入库!"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
ContainerCode = dt.Rows[0]["ContainerCode"].ToString(); |
|
|
|
StartLocation = dt.Rows[0]["StartLocation"].ToString(); |
|
|
|
EndLocation = dt.Rows[0]["EndLocation"].ToString(); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 根据条码获取入库单据信息
|
|
|
|
string chksql = @"select COUNT(B.LotNo) AS LotCount from ICSContainer A
|
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
WHERE ContainerCode='{0}'";
|
|
|
|
chksql = string.Format(chksql, ContainerCode); |
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
sql = @"select E.DNCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'采购入库' AS DocType
|
|
|
|
chksql = string.Format(chksql, ContainerCode); |
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
sql = @"select E.DNCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'采购入库' AS DocType
|
|
|
|
,A.WorkPoint,C.InvCode from ICSContainer A |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint |
|
|
@ -3534,44 +3538,44 @@ namespace ICSSoft.DataProject |
|
|
|
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint |
|
|
|
INNER JOIN ICSMOApplyNegDetail E ON E.ApplyNegCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint |
|
|
|
where A.ContainerCode='{0}'";
|
|
|
|
sql = string.Format(sql, ContainerCode); |
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (chkdt.Rows.Count != dt.Rows.Count) |
|
|
|
{ |
|
|
|
throw new Exception("料架:" + ContainerCode + ",绑定条码的数量与实际查到的条码单据关联数据不符,请确认条码信息!"); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
else |
|
|
|
{ |
|
|
|
#region WMS入库
|
|
|
|
string Identification = Guid.NewGuid().ToString(); |
|
|
|
string BusinessCode = string.Empty; |
|
|
|
foreach (DataRow dr in dt.Rows) |
|
|
|
sql = string.Format(sql, ContainerCode); |
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (chkdt.Rows.Count != dt.Rows.Count) |
|
|
|
{ |
|
|
|
if (dr["DocType"].ToString() == "采购入库") |
|
|
|
{ |
|
|
|
#region 采购入库
|
|
|
|
ICSPurchaseService.DeliveryNoticeIn(dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language); |
|
|
|
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription<DBValue>(); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
else |
|
|
|
throw new Exception("料架:" + ContainerCode + ",绑定条码的数量与实际查到的条码单据关联数据不符,请确认条码信息!"); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
else |
|
|
|
{ |
|
|
|
#region WMS入库
|
|
|
|
string Identification = Guid.NewGuid().ToString(); |
|
|
|
string BusinessCode = string.Empty; |
|
|
|
foreach (DataRow dr in dt.Rows) |
|
|
|
{ |
|
|
|
#region 生产退料入库
|
|
|
|
ICSManufactureService.MOIssueDocNegative(TransTypeEnum.MOIssueDocNegativeApply.GetDescription() |
|
|
|
, "", dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language); |
|
|
|
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription<DBValue>(); |
|
|
|
#endregion
|
|
|
|
if (dr["DocType"].ToString() == "采购入库") |
|
|
|
{ |
|
|
|
#region 采购入库
|
|
|
|
ICSPurchaseService.DeliveryNoticeIn(dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language); |
|
|
|
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription<DBValue>(); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
#region 生产退料入库
|
|
|
|
ICSManufactureService.MOIssueDocNegative(TransTypeEnum.MOIssueDocNegativeApply.GetDescription() |
|
|
|
, "", dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language); |
|
|
|
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription<DBValue>(); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
WareHouseLotInfoUp(Identification, EndLocation, dr["LotNo"].ToString(), dr["Quantity"].ToString(), |
|
|
|
"ForkLift", dr["WorkPoint"].ToString(), "2", BusinessCode |
|
|
|
, cmd, language, "", dr["InvCode"].ToString() + EndLocation.Split('-')[0].ToString() |
|
|
|
, DateTime.Now.ToString()); |
|
|
|
} |
|
|
|
WareHouseLotInfoUp(Identification, EndLocation, dr["LotNo"].ToString(), dr["Quantity"].ToString(), |
|
|
|
"ForkLift", dr["WorkPoint"].ToString(), "2", BusinessCode |
|
|
|
, cmd, language, "", dr["InvCode"].ToString() + EndLocation.Split('-')[0].ToString() |
|
|
|
, DateTime.Now.ToString()); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#region 判断单据是否全部完成入库,并过账SAP
|
|
|
|
string docsql = @"select DISTINCT E.DNCode AS TransNO,'采购入库' AS DocType,A.WorkPoint from ICSContainer A
|
|
|
|
#region 判断单据是否全部完成入库,并过账SAP
|
|
|
|
string docsql = @"select DISTINCT E.DNCode AS TransNO,'采购入库' AS DocType,A.WorkPoint from ICSContainer A
|
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint |
|
|
@ -3584,134 +3588,151 @@ namespace ICSSoft.DataProject |
|
|
|
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint |
|
|
|
INNER JOIN ICSMOApplyNegDetail E ON E.ApplyNegCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint |
|
|
|
where A.ContainerCode='{0}'";
|
|
|
|
docsql = string.Format(docsql, ContainerCode); |
|
|
|
DataTable docdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
foreach (DataRow dr in docdt.Rows) |
|
|
|
{ |
|
|
|
if (dr["DocType"].ToString() == "采购入库") |
|
|
|
docsql = string.Format(docsql, ContainerCode); |
|
|
|
DataTable docdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
foreach (DataRow dr in docdt.Rows) |
|
|
|
{ |
|
|
|
#region 检验合格单过账SAP(检验合格单为两层结构 一行对应一个序列号)
|
|
|
|
chksql = @"select SUM(Quantity) AS Quantity,SUM(RCVQuantity) AS RCVQuantity from ICSDeliveryNotice
|
|
|
|
if (dr["DocType"].ToString() == "采购入库") |
|
|
|
{ |
|
|
|
#region 检验合格单过账SAP(检验合格单为两层结构 一行对应一个序列号)
|
|
|
|
chksql = @"select SUM(Quantity) AS Quantity,SUM(RCVQuantity) AS RCVQuantity from ICSDeliveryNotice
|
|
|
|
where DNCode='{0}' and WorkPoint='{1}' |
|
|
|
GROUP BY DNCode,WorkPoint";
|
|
|
|
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) != Convert.ToDecimal(chkdt.Rows[0]["RCVQuantity"])) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
sql = @"select A.DNCode,
|
|
|
|
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) != Convert.ToDecimal(chkdt.Rows[0]["RCVQuantity"])) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
sql = @"select A.DNCode,
|
|
|
|
CASE WHEN SUM(Convert(decimal(18,6),A.SAPSequence)) IS NULL THEN SUM(A.RCVQuantity) |
|
|
|
ELSE SUM(Convert(decimal(18,6),A.SAPSequence)) END AS RCVQuantity,B.BatchCode from ICSDeliveryNotice A |
|
|
|
LEFT JOIN ICSExtension B ON B.ID=A.ExtensionID AND B.WorkPoint=A.WorkPoint |
|
|
|
WHERE DNCode='{0}' AND A.WorkPoint='{1}' |
|
|
|
GROUP BY A.DNCode,B.BatchCode";
|
|
|
|
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (Sapdt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo205"), dr["TransNO"].ToString()));//单据查询失败
|
|
|
|
} |
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU Client = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU(); |
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1 Info = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1(); |
|
|
|
Info.NEWID = Guid.NewGuid().ToString(); |
|
|
|
Info.PRUEFLOS = Sapdt.Rows[0]["DNCode"].ToString(); |
|
|
|
Info.L_LME = System.Decimal.Round(Convert.ToDecimal(Sapdt.Rows[0]["RCVQuantity"].ToString()), 3); |
|
|
|
Info.SERNP = Sapdt.Rows[0]["BatchCode"].ToString(); |
|
|
|
Info.Z_GERNR = new SAPCallBackJYHGDVPN.ZWEBS_GERNR[0]; |
|
|
|
|
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse result = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse(); |
|
|
|
result = Client.CallZWMS_SK_WS_RUKU(Info); |
|
|
|
if (result.Z_NULL == "N") |
|
|
|
{ |
|
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
|
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (Sapdt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo205"), dr["TransNO"].ToString()));//单据查询失败
|
|
|
|
} |
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU Client = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU(); |
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1 Info = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1(); |
|
|
|
Info.NEWID = Guid.NewGuid().ToString(); |
|
|
|
Info.PRUEFLOS = Sapdt.Rows[0]["DNCode"].ToString(); |
|
|
|
Info.L_LME = System.Decimal.Round(Convert.ToDecimal(Sapdt.Rows[0]["RCVQuantity"].ToString()), 3); |
|
|
|
Info.SERNP = Sapdt.Rows[0]["BatchCode"].ToString(); |
|
|
|
Info.Z_GERNR = new SAPCallBackJYHGDVPN.ZWEBS_GERNR[0]; |
|
|
|
|
|
|
|
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse result = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse(); |
|
|
|
result = Client.CallZWMS_SK_WS_RUKU(Info); |
|
|
|
if (result.Z_NULL == "N") |
|
|
|
{ |
|
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
|
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1) |
|
|
|
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'叉车入库','{3}'";
|
|
|
|
logsql = string.Format(logsql, "采购入库", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
|
, result.L_MESSAGE); |
|
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
|
logsql = string.Format(logsql, "采购入库", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
|
, result.L_MESSAGE); |
|
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
#region SAP(三层结构)
|
|
|
|
string ErrorMessage = ""; |
|
|
|
chksql = @"select SUM(B.Quantity) AS Quantity,SUM(B.IssueNegQuantity) AS IssueQuantity from ICSMOApplyNeg A
|
|
|
|
else |
|
|
|
{ |
|
|
|
#region SAP(三层结构)
|
|
|
|
string ErrorMessage = ""; |
|
|
|
chksql = @"select SUM(B.Quantity) AS Quantity,SUM(B.IssueNegQuantity) AS IssueQuantity from ICSMOApplyNeg A
|
|
|
|
LEFT JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.ApplyNegCode AND B.WorkPoint=A.WorkPoint |
|
|
|
where A.ApplyNegCode='{0}' and A.WorkPoint='{1}' |
|
|
|
GROUP BY A.ApplyNegCode,A.WorkPoint";
|
|
|
|
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) == Convert.ToDecimal(chkdt.Rows[0]["IssueQuantity"])) |
|
|
|
{ |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZ Client = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ(); |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZ1 Info = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ1(); |
|
|
|
Info.NEWID = Guid.NewGuid().ToString(); |
|
|
|
Info.DANJU = dr["TransNO"].ToString(); |
|
|
|
Info.STATE = "0"; |
|
|
|
List<SAPCallBackDocVPN.ZWMS_PZ> ItemList = new List<SAPCallBackDocVPN.ZWMS_PZ>(); |
|
|
|
List<SAPCallBackDocVPN.ZWEBS_GERNR> ItemLineList = new List<SAPCallBackDocVPN.ZWEBS_GERNR>(); |
|
|
|
Info.Z_FLAG = new SAPCallBackDocVPN.ZWEB_RETURN[1]; |
|
|
|
sql = @" select A.ApplyNegCode,B.SAPSequence,B.InvCode,B.Sequence,B.Quantity,B.IssueNegQuantity
|
|
|
|
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) == Convert.ToDecimal(chkdt.Rows[0]["IssueQuantity"])) |
|
|
|
{ |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZ Client = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ(); |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZ1 Info = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ1(); |
|
|
|
Info.NEWID = Guid.NewGuid().ToString(); |
|
|
|
Info.DANJU = dr["TransNO"].ToString(); |
|
|
|
Info.STATE = "0"; |
|
|
|
List<SAPCallBackDocVPN.ZWMS_PZ> ItemList = new List<SAPCallBackDocVPN.ZWMS_PZ>(); |
|
|
|
List<SAPCallBackDocVPN.ZWEBS_GERNR> ItemLineList = new List<SAPCallBackDocVPN.ZWEBS_GERNR>(); |
|
|
|
Info.Z_FLAG = new SAPCallBackDocVPN.ZWEB_RETURN[1]; |
|
|
|
sql = @" select A.ApplyNegCode,B.SAPSequence,B.InvCode,B.Sequence,B.Quantity,B.IssueNegQuantity
|
|
|
|
,ISNULL(C.BatchCode,'') AS BatchCode from ICSMOApplyNeg A |
|
|
|
LEFT JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.ApplyNegCode AND B.WorkPoint=A.WorkPoint |
|
|
|
LEFT JOIN ICSExtension C ON C.ID=B.ExtensionID AND C.WorkPoint=B.WorkPoint |
|
|
|
WHERE A.ApplyNegCode='{0}' AND A.WorkPoint='{1}'";
|
|
|
|
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
foreach (DataRow drs in Sapdt.Rows) |
|
|
|
{ |
|
|
|
if (Convert.ToDecimal(drs["Quantity"].ToString()) == Convert.ToDecimal(drs["IssueNegQuantity"].ToString())) |
|
|
|
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString()); |
|
|
|
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
foreach (DataRow drs in Sapdt.Rows) |
|
|
|
{ |
|
|
|
SAPCallBackDocVPN.ZWMS_PZ Item = new SAPCallBackDocVPN.ZWMS_PZ(); |
|
|
|
SAPCallBackDocVPN.ZWEBS_GERNR ItemLine = new SAPCallBackDocVPN.ZWEBS_GERNR(); |
|
|
|
Item.DANJU = drs["ApplyNegCode"].ToString(); |
|
|
|
Item.POSNR = drs["SAPSequence"].ToString(); |
|
|
|
Item.LINGYSL = System.Decimal.Round(Convert.ToDecimal(drs["Quantity"].ToString()), 3); |
|
|
|
ItemList.Add(Item); |
|
|
|
if (drs["BatchCode"].ToString() != "") |
|
|
|
if (Convert.ToDecimal(drs["Quantity"].ToString()) == Convert.ToDecimal(drs["IssueNegQuantity"].ToString())) |
|
|
|
{ |
|
|
|
ItemLine.DANJU = drs["ApplyNegCode"].ToString(); |
|
|
|
ItemLine.POSNR = drs["SAPSequence"].ToString(); |
|
|
|
ItemLine.MATNR = drs["InvCode"].ToString(); |
|
|
|
ItemLine.GERNR = drs["BatchCode"].ToString(); |
|
|
|
ItemLineList.Add(ItemLine); |
|
|
|
SAPCallBackDocVPN.ZWMS_PZ Item = new SAPCallBackDocVPN.ZWMS_PZ(); |
|
|
|
SAPCallBackDocVPN.ZWEBS_GERNR ItemLine = new SAPCallBackDocVPN.ZWEBS_GERNR(); |
|
|
|
Item.DANJU = drs["ApplyNegCode"].ToString(); |
|
|
|
Item.POSNR = drs["SAPSequence"].ToString(); |
|
|
|
Item.LINGYSL = System.Decimal.Round(Convert.ToDecimal(drs["Quantity"].ToString()), 3); |
|
|
|
ItemList.Add(Item); |
|
|
|
if (drs["BatchCode"].ToString() != "") |
|
|
|
{ |
|
|
|
ItemLine.DANJU = drs["ApplyNegCode"].ToString(); |
|
|
|
ItemLine.POSNR = drs["SAPSequence"].ToString(); |
|
|
|
ItemLine.MATNR = drs["InvCode"].ToString(); |
|
|
|
ItemLine.GERNR = drs["BatchCode"].ToString(); |
|
|
|
ItemLineList.Add(ItemLine); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ItemList.Count > 0) |
|
|
|
{ |
|
|
|
Info.Z_ITEM = ItemList.ToArray(); |
|
|
|
if (ItemLineList.Count > 0) |
|
|
|
if (ItemList.Count > 0) |
|
|
|
{ |
|
|
|
Info.Z_GERNR = ItemLineList.ToArray(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Info.Z_GERNR = new SAPCallBackDocVPN.ZWEBS_GERNR[1]; |
|
|
|
} |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse result = new SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse(); |
|
|
|
result = Client.CallZWMS_SK_WS_PZ(Info); |
|
|
|
if (result.Z_NULL == "N") |
|
|
|
{ |
|
|
|
foreach (SAPCallBackDocVPN.ZWEB_RETURN resultItem in result.Z_FLAG) |
|
|
|
Info.Z_ITEM = ItemList.ToArray(); |
|
|
|
if (ItemLineList.Count > 0) |
|
|
|
{ |
|
|
|
ErrorMessage += resultItem.L_MESSAGE + "/r/n"; |
|
|
|
Info.Z_GERNR = ItemLineList.ToArray(); |
|
|
|
} |
|
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
|
else |
|
|
|
{ |
|
|
|
Info.Z_GERNR = new SAPCallBackDocVPN.ZWEBS_GERNR[1]; |
|
|
|
} |
|
|
|
SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse result = new SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse(); |
|
|
|
result = Client.CallZWMS_SK_WS_PZ(Info); |
|
|
|
if (result.Z_NULL == "N") |
|
|
|
{ |
|
|
|
foreach (SAPCallBackDocVPN.ZWEB_RETURN resultItem in result.Z_FLAG) |
|
|
|
{ |
|
|
|
ErrorMessage += resultItem.L_MESSAGE + "/r/n"; |
|
|
|
} |
|
|
|
string logsql = @"insert into ICSWMSCallSAPErrorLog
|
|
|
|
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1) |
|
|
|
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'叉车入库','{3}'";
|
|
|
|
logsql = string.Format(logsql, "生产退料", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
|
, ErrorMessage); |
|
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
|
logsql = string.Format(logsql, "生产退料", dr["TransNO"].ToString(), dr["WorkPoint"].ToString() |
|
|
|
, ErrorMessage); |
|
|
|
DBHelper.ExecuteNonQuery(logsql, cmd); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
else if (TaskType == "PICK出库") |
|
|
|
{ |
|
|
|
#region 出库(仅记录叉车搬运到的出库点位,用于后面的回库)
|
|
|
|
|
|
|
|
string sql = @" Update ICSForkLiftTaskLog SET EndLocation='{0}'
|
|
|
|
where ReqCode='{1}'";
|
|
|
|
sql = string.Format(sql, DestBin, TaskID); |
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
//throw new Exception("任务编码:" + TaskCode + ",日志记录失败");//料架状态更新失败
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@ -3732,7 +3753,7 @@ namespace ICSSoft.DataProject |
|
|
|
try |
|
|
|
{ |
|
|
|
|
|
|
|
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' )
|
|
|
|
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' )
|
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{1}") + @"',16,1); |
|
|
|
RETURN |
|
|
@ -3745,10 +3766,10 @@ namespace ICSSoft.DataProject |
|
|
|
END; |
|
|
|
SELECT top 1 Desks FROM ICSMOApply WHERE ApplyCode='{2}' |
|
|
|
";
|
|
|
|
sql = string.Format(sql, containerCode, User, tranCodes.FirstOrDefault()); |
|
|
|
sql = string.Format(sql, containerCode, User, tranCodes.FirstOrDefault()); |
|
|
|
|
|
|
|
var table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (table.Rows.Count<=0) |
|
|
|
if (table.Rows.Count <= 0) |
|
|
|
{ |
|
|
|
throw new Exception("单据对应的工位不存在,操作失败"); |
|
|
|
} |
|
|
@ -3761,16 +3782,16 @@ namespace ICSSoft.DataProject |
|
|
|
END; |
|
|
|
IF NOT EXISTS( SELECT ID FROM ICSMOApply WHERE ApplyCode='{0}' AND Desks='{1}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('"+language.GetNameByCode("WMSAPIInfo477") + @"',16,1); |
|
|
|
RAISERROR('" + language.GetNameByCode("WMSAPIInfo477") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
IF EXISTS(select ID from ICSContainerReceiptsNumber where ContainerCode='{2}' AND TransCode='{0}') |
|
|
|
BEGIN |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}","{2}") + @"',16,1); |
|
|
|
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}", "{2}") + @"',16,1); |
|
|
|
RETURN |
|
|
|
END; |
|
|
|
INSERT INTO ICSContainerReceiptsNumber SELECT NEWID(),'{0}','{2}',F_Account,F_RealName,GETDATE(),NULL,NULL,NULL,NULL,NULL FROM Sys_SRM_User WHERE F_Account='{3}' ";
|
|
|
|
sqlCheck= string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(),containerCode, User); |
|
|
|
sqlCheck = string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(), containerCode, User); |
|
|
|
if (!DBHelper.ExecuteNonQuery(sqlCheck, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception("单据新增失败"); |
|
|
@ -3787,11 +3808,11 @@ namespace ICSSoft.DataProject |
|
|
|
/// </summary>
|
|
|
|
/// <param name="LotNo"></param>
|
|
|
|
/// <param name="cmd"></param>
|
|
|
|
public static DataTable GetWHCodeArea(string LotNo,SqlCommand cmd) |
|
|
|
public static DataTable GetWHCodeArea(string LotNo, SqlCommand cmd) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
string check = $@"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
|
|
|
|
string check = $@"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
|
|
|
|
INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint |
|
|
|
WHERE A.LotNo='{LotNo}' |
|
|
|