|
|
@ -912,6 +912,7 @@ namespace ICSSoft.DataProject |
|
|
|
public static Result BarCodeInformationGet(BarCodeModel JsonData) |
|
|
|
{ |
|
|
|
var language = LanguageHelper.GetName("WMSAPIInfo"); |
|
|
|
DataTable table = new DataTable(); |
|
|
|
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) |
|
|
|
{ |
|
|
|
conn.Open(); |
|
|
@ -939,8 +940,119 @@ namespace ICSSoft.DataProject |
|
|
|
|
|
|
|
string TransType = JsonData.TransType; |
|
|
|
string sql = ""; |
|
|
|
string Losql = ""; |
|
|
|
string sqlNew = ""; |
|
|
|
#region SLQ
|
|
|
|
if (TransType == TransTypeEnum.LocationSeatch.GetDescription()) |
|
|
|
{ |
|
|
|
//Losql = @"SELECT a.ID,
|
|
|
|
// con.ContainerCode,
|
|
|
|
// con.ContainerName,
|
|
|
|
// a.LotNo,
|
|
|
|
// a.InvCode,
|
|
|
|
// inv.InvName,
|
|
|
|
// inv.InvStd,
|
|
|
|
// inv.InvUnit,
|
|
|
|
// inv.LotEnable,
|
|
|
|
// {0}
|
|
|
|
// inv.AmountUnit,
|
|
|
|
// ext.ID AS ExtensionID,
|
|
|
|
// 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 AS [User],
|
|
|
|
// a.MTIME AS [MTime]
|
|
|
|
// FROM {1}
|
|
|
|
// LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint
|
|
|
|
// LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint
|
|
|
|
// INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
|
|
|
|
// WHERE a.Quantity>0 and a.WorkPoint='{3}'";
|
|
|
|
Losql = @"DECLARE @aa VARCHAR(MAX)
|
|
|
|
DECLARE @bb VARCHAR(MAX) |
|
|
|
DECLARE @cc VARCHAR(MAX) |
|
|
|
DECLARE @b VARCHAR(MAX) |
|
|
|
set @b = |
|
|
|
'SELECT a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode, |
|
|
|
inv.InvName, |
|
|
|
inv.InvStd, |
|
|
|
inv.InvUnit, |
|
|
|
inv.LotEnable, |
|
|
|
s.WarehouseCode,sum(a.Quantity) as Qty,s.sumQty, |
|
|
|
inv.AmountUnit, |
|
|
|
ext.ID AS ExtensionID, |
|
|
|
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 AS [User], |
|
|
|
a.MTIME AS [MTime] |
|
|
|
FROM ICSWareHouseLotInfo a |
|
|
|
LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint |
|
|
|
INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint |
|
|
|
LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode from ICSWareHouseLotInfo group by WarehouseCode,INVCode)s ON a.INVCode=s.INVCode |
|
|
|
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint |
|
|
|
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint |
|
|
|
WHERE a.Quantity>0 and a.WorkPoint=''{3}'' and' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @aa=id from ICSWareHouseLotInfo where LotNo='{2}' |
|
|
|
|
|
|
|
IF @aa IS NOT NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' lot.invcode IN(SELECT invcode FROM ICSWareHouseLotInfo where LotNo=''{2}'') |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,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 |
|
|
|
' |
|
|
|
END |
|
|
|
|
|
|
|
|
|
|
|
select @bb=id from ICSLocation where LocationCode='{2}' |
|
|
|
|
|
|
|
IF @bb IS not NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' a.WarehouseCode=s.WarehouseCode and a.LocationCode=''{2}'' |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,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' |
|
|
|
END |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @cc=id from ICSInventory where invcode='{2}' |
|
|
|
IF @cc IS not NULL |
|
|
|
BEGIN |
|
|
|
set @b = @b+' a.WarehouseCode=s.WarehouseCode and inv.invcode=''{2}'' |
|
|
|
group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit, |
|
|
|
ext.ID,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' |
|
|
|
END |
|
|
|
exec(@b) |
|
|
|
|
|
|
|
";
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (ScanType == "LOTNO") |
|
|
|
{ |
|
|
|
sql = @"SELECT a.ID,
|
|
|
@ -1011,11 +1123,16 @@ namespace ICSSoft.DataProject |
|
|
|
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint |
|
|
|
WHERE bom.ContainerCode='{2}' AND a.WorkPoint='{3}' ";
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
bool isOut = false; //出库标记
|
|
|
|
string columns = string.Empty; //查询源头单据表的特殊列名
|
|
|
|
string tableName = string.Empty; //查询源头单据表名
|
|
|
|
string where = string.Empty; //排序
|
|
|
|
if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription() //采购退货
|
|
|
|
|| TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription() //委外发料
|
|
|
|
|| TransType == TransTypeEnum.OutsourcingReturnBack.GetDescription() //委外退货
|
|
|
@ -1039,6 +1156,24 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
isOut = true; |
|
|
|
} |
|
|
|
//库位查询
|
|
|
|
if (TransType == TransTypeEnum.LocationSeatch.GetDescription()) |
|
|
|
{ |
|
|
|
// Losql = @"" + Losql + "group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit,ext.ID,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 = @"s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,sum(a.Quantity) as Qty,s.sumQty,";
|
|
|
|
|
|
|
|
// tableName = @"ICSWareHouseLotInfo a
|
|
|
|
//LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint
|
|
|
|
//INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint
|
|
|
|
//INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint
|
|
|
|
//LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode from ICSWareHouseLotInfo group by WarehouseCode,INVCode)s
|
|
|
|
//ON a.INVCode=s.INVCode ";
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//两步调入条码
|
|
|
|
if (TransType == TransTypeEnum.TwoStepTransferDocIn.GetDescription()) |
|
|
|
{ |
|
|
@ -1265,7 +1400,7 @@ namespace ICSSoft.DataProject |
|
|
|
type = "5"; |
|
|
|
msglanguage = "WMSAPIInfo188"; |
|
|
|
} |
|
|
|
else if(TransType == TransTypeEnum.ICSOutsourcingIssueDoNegativeApply.GetDescription()) |
|
|
|
else if (TransType == TransTypeEnum.ICSOutsourcingIssueDoNegativeApply.GetDescription()) |
|
|
|
{ |
|
|
|
type = "6"; |
|
|
|
msglanguage = "WMSAPIInfo189"; |
|
|
@ -1462,7 +1597,7 @@ namespace ICSSoft.DataProject |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
//分批
|
|
|
|
else if (TransType == TransTypeEnum.LOTSplit.GetDescription()|| TransType == TransTypeEnum.LOTMerge.GetDescription()) |
|
|
|
else if (TransType == TransTypeEnum.LOTSplit.GetDescription() || TransType == TransTypeEnum.LOTMerge.GetDescription()) |
|
|
|
{ |
|
|
|
sql = @"IF NOT EXISTS(SELECT a.ID FROM ICSWareHouseLotInfo a WHERE a.LotNo='{2}' AND a.WorkPoint='{3}' AND a.Quantity>0)
|
|
|
|
BEGIN |
|
|
@ -1654,12 +1789,29 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (TransType != TransTypeEnum.LocationSeatch.GetDescription()) |
|
|
|
{ |
|
|
|
if (string.IsNullOrWhiteSpace(columns) || string.IsNullOrWhiteSpace(tableName)) |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo003")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (TransType == TransTypeEnum.LocationSeatch.GetDescription()) |
|
|
|
{ |
|
|
|
Losql = string.Format(Losql, columns, tableName, JsonData.Code, JsonData.WorkPoint); |
|
|
|
|
|
|
|
table = DBHelper.SQlReturnData(Losql, cmd); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sql = string.Format(sql, columns, tableName, JsonData.Code, JsonData.WorkPoint); |
|
|
|
|
|
|
|
DataTable table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
table = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
} |
|
|
|
|
|
|
|
if (table == null || table.Rows.Count <= 0) |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo008"));//"未查询到条码数据!"
|
|
|
|
|
|
|
@ -1692,7 +1844,7 @@ namespace ICSSoft.DataProject |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else if(TransType != TransTypeEnum.LocationSeatch.GetDescription()) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(JsonData.TransCode)) |
|
|
|
{ |
|
|
|