Browse Source

退料类型区分

master
lixh 3 years ago
parent
commit
9600784768
  1. 1
      ICSSoft.WMS.WebAPI/ICSSoft.Common/HTTPHelper.cs
  2. 206
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs

1
ICSSoft.WMS.WebAPI/ICSSoft.Common/HTTPHelper.cs

@ -14,6 +14,7 @@ namespace ICSSoft.Common
{
try
{
//log.Debug(url + Environment.NewLine + body);
Encoding encoding = Encoding.UTF8;
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.Method = "POST";

206
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs

@ -2012,23 +2012,7 @@ namespace ICSSoft.DataProject
}
}
//校验退料数量是否超出领料数量
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSOApplyNegDetail a
INNER JOIN ICSOOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
sql = string.Format(sql, item.id, item.WorkPoint);
sql = CheckOutsourcingIssueDoc(item.Type, item.id, item.WorkPoint, language);
DBHelper.ExecuteNonQuery(sql, cmd);
codes += "'" + Code + item.WorkPoint + "',";
}
@ -2096,6 +2080,74 @@ namespace ICSSoft.DataProject
}
}
private static string CheckOutsourcingIssueDoc(string Type, string ID, string WorkPoint, Dictionary<string, string> language)
{
string sql = string.Empty;
if (Type == "1")
{
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSOApplyNegDetail a
INNER JOIN ICSOOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSOOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else if (Type == "2")
{
sql = @"DECLARE @ApplyDetailID VARCHAR(10)
SELECT @ApplyDetailID=b.ApplyDetailID
FROM ICSOApplyNegDetail a
INNER JOIN ICSOApply b ON a.SourceDetailID=b.ApplyDetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.ApplyDetailID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@ApplyDetailID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSOApply WHERE ApplyDetailID=@ApplyDetailID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else if (Type == "3")
{
sql = @"DECLARE @IssueDetailID VARCHAR(10)
SELECT @IssueDetailID=b.IssueDetailID
FROM ICSOApplyNegDetail a
INNER JOIN ICSOIssue b ON a.SourceDetailID=b.IssueDetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.IssueDetailID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@IssueDetailID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSOIssue WHERE IssueDetailID=@IssueDetailID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else
{
throw new Exception(language.GetNameByCode("WMSAPIInfo003"));//"类型不符!");
}
sql = string.Format(sql, ID, WorkPoint, Type);
return sql;
}
/// <summary>
/// 委外退料 修改
/// </summary>
@ -2181,23 +2233,7 @@ namespace ICSSoft.DataProject
}
}
//校验退料数量是否超出领料数量
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSOApplyNegDetail a
INNER JOIN ICSOOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSOApplyNeg c ON a.OApplyNegCode=c.OApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
sql = string.Format(sql, item.id, item.WorkPoint);
sql = CheckOutsourcingIssueDoc(item.Type, item.id, item.WorkPoint, language);
DBHelper.ExecuteNonQuery(sql, cmd);
ids += "'" + item.id + "',";
}
@ -2814,23 +2850,7 @@ namespace ICSSoft.DataProject
}
}
//校验退料数量是否超出领料数量
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSMOApplyNegDetail a
INNER JOIN ICSMOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
sql = string.Format(sql, item.ID, item.WorkPoint);
sql = CheckMOIssueDoc(item.Type, item.ID, item.WorkPoint, language);
DBHelper.ExecuteNonQuery(sql, cmd);
codes += "'" + Code + item.WorkPoint + "',";
}
@ -2897,7 +2917,73 @@ namespace ICSSoft.DataProject
}
}
}
private static string CheckMOIssueDoc(string Type, string ID, string WorkPoint, Dictionary<string, string> language)
{
string sql = string.Empty;
if (Type == "1")
{
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSMOApplyNegDetail a
INNER JOIN ICSMOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else if (Type == "2")
{
sql = @"DECLARE @ApplyDetailID VARCHAR(10)
SELECT @ApplyDetailID=b.ApplyDetailID
FROM ICSMOApplyNegDetail a
INNER JOIN ICSMOApply b ON a.SourceDetailID=b.ApplyDetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.ApplyDetailID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@ApplyDetailID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOApply WHERE ApplyDetailID=@ApplyDetailID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else if (Type == "3")
{
sql = @"DECLARE @IssueDetailID VARCHAR(10)
SELECT @IssueDetailID=b.IssueDetailID
FROM ICSMOApplyNegDetail a
INNER JOIN ICSMOIssue b ON a.SourceDetailID=b.IssueDetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}'
GROUP BY b.IssueDetailID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@IssueDetailID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOIssue WHERE IssueDetailID=@IssueDetailID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
}
else
{
throw new Exception(language.GetNameByCode("WMSAPIInfo003"));//"类型不符!");
}
sql = string.Format(sql, ID, WorkPoint, Type);
return sql;
}
/// <summary>
/// 生产退料 修改
/// </summary>
@ -2982,23 +3068,7 @@ namespace ICSSoft.DataProject
}
}
//校验退料数量是否超出领料数量
sql = @"DECLARE @PickID VARCHAR(10)
SELECT @PickID=b.PickID
FROM ICSMOApplyNegDetail a
INNER JOIN ICSMOPick b ON a.SourceDetailID=b.PickID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint
WHERE c.ID='{0}' AND a.WorkPoint='{1}'
GROUP BY b.PickID
HAVING MAX(b.Quantity)<SUM(a.Quantity)
IF (@PickID IS NOT NULL)
BEGIN
DECLARE @InvCode VARCHAR(100)
SELECT @InvCode='" + language.GetNameByCode("WMSAPIInfo064") + @"' FROM ICSMOPick WHERE PickID=@PickID AND WorkPoint='{1}'
RAISERROR(@InvCode,16,1);
RETURN
END ";
sql = string.Format(sql, item.ID, item.WorkPoint);
sql = CheckMOIssueDoc(item.Type, item.ID, item.WorkPoint, language);
DBHelper.ExecuteNonQuery(sql, cmd);
ids += "'" + item.ID + "',";
}

Loading…
Cancel
Save