|
|
@ -76,7 +76,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
ISNULL(ext.ProjectCode, '') AS ProjectCode, |
|
|
|
a.ExtensionID, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode, |
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
ISNULL(ext.Version, '') AS Version, |
|
|
|
ISNULL(ext.Brand, '') AS Brand, |
|
|
|
ISNULL(ext.cFree1, '') AS cFree1, |
|
|
@ -250,7 +250,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
a.ExtensionID, |
|
|
|
ext.ProjectCode, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
ext.Version, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
@ -745,7 +745,7 @@ namespace ICSSoft.DataProject |
|
|
|
END |
|
|
|
" + sql + "AND Otin.InCode = '" + JsonData.TransCode + "'"
|
|
|
|
+ @"GROUP BY a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode,
|
|
|
|
wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, |
|
|
|
wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, |
|
|
|
ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER,a.MTIME";
|
|
|
|
|
|
|
|
columns = @"SUM(log.Quantity) AS Quantity,
|
|
|
@ -754,7 +754,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
a.LocationCode, |
|
|
|
loc.LocationName, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
|
|
|
|
tableName = @"ICSOtherIn Otin
|
|
|
|
INNER JOIN ICSTransfer tra ON Otin.TransferDetailID=tra.TransferDetailID AND Otin.WorkPoint=tra.WorkPoint |
|
|
@ -784,7 +784,7 @@ namespace ICSSoft.DataProject |
|
|
|
END |
|
|
|
" + sql + "AND sdn.SDNCode = '" + JsonData.TransCode + "'"
|
|
|
|
+ @"GROUP BY a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode,
|
|
|
|
wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, |
|
|
|
wh.WarehouseName,a.LocationCode,loc.LocationName,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END,inv.AmountUnit, |
|
|
|
ext.ProjectCode,ext.Version,ext.Brand,ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER,a.MTIME";
|
|
|
|
|
|
|
|
columns = @"SUM(log.Quantity) AS Quantity,
|
|
|
@ -793,7 +793,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
a.LocationCode, |
|
|
|
loc.LocationName, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
|
|
|
|
tableName = @"ICSSDN sdn
|
|
|
|
INNER JOIN ICSWareHouseLotInfoLog log ON sdn.SDNCode=log.TransCode AND sdn.Sequence=log.TransSequence AND sdn.WorkPoint=log.WorkPoint |
|
|
@ -820,7 +820,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
a.LocationCode, |
|
|
|
loc.LocationName, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
ISNULL(split.SplitLotNo, a.LotNo+'-1') AS SplitLotNo,";
|
|
|
|
|
|
|
|
tableName = @"ICSWareHouseLotInfo a
|
|
|
@ -847,7 +847,7 @@ namespace ICSSoft.DataProject |
|
|
|
wh.WarehouseName AS WHName, |
|
|
|
a.LocationCode, |
|
|
|
loc.LocationName, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,";
|
|
|
|
|
|
|
|
tableName = @"ICSWareHouseLotInfo a
|
|
|
|
INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint |
|
|
@ -2012,7 +2012,7 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
} |
|
|
|
//校验退料数量是否超出领料数量
|
|
|
|
sql = CheckOutsourcingIssueDoc(item.Type, item.id, item.WorkPoint, language); |
|
|
|
sql = CheckOutsourcingIssueDoc(item.Type, Code, item.WorkPoint, language); |
|
|
|
DBHelper.ExecuteNonQuery(sql, cmd); |
|
|
|
codes += "'" + Code + item.WorkPoint + "',"; |
|
|
|
} |
|
|
@ -2080,71 +2080,83 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static string CheckOutsourcingIssueDoc(string Type, string ID, string WorkPoint, Dictionary<string, string> language) |
|
|
|
private static string CheckOutsourcingIssueDoc(string Type, string Code, string WorkPoint, Dictionary<string, string> language) |
|
|
|
{ |
|
|
|
string sql = string.Empty; |
|
|
|
if (Type == "1") |
|
|
|
{ |
|
|
|
sql = @"DECLARE @PickID VARCHAR(10)
|
|
|
|
SELECT @PickID=b.PickID |
|
|
|
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.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
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) |
|
|
|
WHERE c.OApplyNegCode='{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 ";
|
|
|
|
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 |
|
|
|
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.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
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) |
|
|
|
WHERE c.OApplyNegCode='{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 ";
|
|
|
|
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 |
|
|
|
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.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
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) |
|
|
|
WHERE c.OApplyNegCode='{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 ";
|
|
|
|
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); |
|
|
|
sql = string.Format(sql, Code, WorkPoint, Type); |
|
|
|
return sql; |
|
|
|
} |
|
|
|
|
|
|
@ -2233,7 +2245,7 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
} |
|
|
|
//校验退料数量是否超出领料数量
|
|
|
|
sql = CheckOutsourcingIssueDoc(item.Type, item.id, item.WorkPoint, language); |
|
|
|
sql = CheckOutsourcingIssueDoc(item.Type, Code, item.WorkPoint, language); |
|
|
|
DBHelper.ExecuteNonQuery(sql, cmd); |
|
|
|
ids += "'" + item.id + "',"; |
|
|
|
} |
|
|
@ -2927,7 +2939,11 @@ namespace ICSSoft.DataProject |
|
|
|
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}' |
|
|
|
WHERE c.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
FROM ICSMOApplyNegDetail a |
|
|
|
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint |
|
|
|
WHERE c.ApplyNegCode='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}') |
|
|
|
GROUP BY b.PickID |
|
|
|
HAVING MAX(b.Quantity)<SUM(a.Quantity) |
|
|
|
|
|
|
@ -2946,7 +2962,11 @@ namespace ICSSoft.DataProject |
|
|
|
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}' |
|
|
|
WHERE c.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
FROM ICSMOApplyNegDetail a |
|
|
|
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint |
|
|
|
WHERE c.ApplyNegCode='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}') |
|
|
|
GROUP BY b.ApplyDetailID |
|
|
|
HAVING MAX(b.Quantity)<SUM(a.Quantity) |
|
|
|
|
|
|
@ -2965,7 +2985,11 @@ namespace ICSSoft.DataProject |
|
|
|
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}' |
|
|
|
WHERE c.Type='{2}' AND a.WorkPoint='{1}' |
|
|
|
AND a.SourceDetailID IN (SELECT a.SourceDetailID |
|
|
|
FROM ICSMOApplyNegDetail a |
|
|
|
INNER JOIN ICSMOApplyNeg c ON a.ApplyNegCode=c.ApplyNegCode AND a.WorkPoint=c.WorkPoint |
|
|
|
WHERE c.ApplyNegCode='{0}' AND c.Type='{2}' AND a.WorkPoint='{1}') |
|
|
|
GROUP BY b.IssueDetailID |
|
|
|
HAVING MAX(b.Quantity)<SUM(a.Quantity) |
|
|
|
|
|
|
@ -3616,7 +3640,7 @@ namespace ICSSoft.DataProject |
|
|
|
inv.AmountUnit, |
|
|
|
{1} |
|
|
|
ext.ProjectCode, |
|
|
|
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode, |
|
|
|
ext.Version, |
|
|
|
ext.Brand, |
|
|
|
ext.cFree1, |
|
|
|