@ -918,18 +918,18 @@ namespace ICSSoft.DataProject
WHERE { 2 } ";
#endregion
}
else if ( isMerge ) //合并发料
else if ( isMerge ) //合并发料
{
#region SLQ
string sqlMerge = "SELECT ID FROM ICSMOPickMerge WHERE MergeID='" + JsonData . TransCode + "' AND WorkPoint='" + JsonData . WorkPoint + "'" ;
string sqlMerge = "SELECT ID FROM ICSMOPickMerge WHERE MergeID='" + JsonData . TransCode + "' AND WorkPoint='" + JsonData . WorkPoint + "'" ;
DataTable sign = DBHelper . SQlReturnData ( sqlMerge , cmd ) ;
if ( sign ! = null & & flag . Rows . Count > 0 )
{
string whereMerge = string . Format ( "mer.MergeID='{0}' AND mer.WorkPoint='{1}'" , JsonData . TransCode , JsonData . WorkPoint ) ;
sql = string . Format ( sql , columnsMerge , tableNameMerge , whereMerge , JsonData . TransCode , JsonData . WorkPoint ) ;
}
else
else
{
sql = @ " BEGIN
IF EXISTS ( SELECT a . ID FROM { 1 } INNER JOIN ICSMOPickMerge c ON a . ID = c . SourceID AND a . WorkPoint = c . WorkPoint WHERE { 2 } )
@ -939,14 +939,14 @@ namespace ICSSoft.DataProject
END
" + sqlCheck + sql + @"
END ";
}
}
#endregion
}
else
{
sql = sqlCheck + sql ;
}
where = string . Format ( where , JsonData . TransCode , JsonData . WorkPoint ) ;
sql = string . Format ( sql , columns , tableName , where , JsonData . TransCode ) ;
@ -970,6 +970,132 @@ namespace ICSSoft.DataProject
}
#endregion
#region 料架信息
/// <summary>
/// 料架验证
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static Result ContainerCheck ( ICSContainerInfo JsonData )
{
var language = LanguageHelper . GetName ( "WMSAPIInfo" ) ;
DataTable table = new DataTable ( ) ;
string msg = "" ;
using ( SqlConnection conn = new System . Data . SqlClient . SqlConnection ( connString ) )
{
conn . Open ( ) ;
SqlCommand cmd = new SqlCommand ( ) ;
cmd . Connection = conn ;
try
{
string TransType = JsonData . TransType ;
string ContainerID = "" ;
if ( String . IsNullOrEmpty ( JsonData . ContainerCode ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo007" ) ) ; //"传入数据为空!"
}
if ( String . IsNullOrEmpty ( JsonData . WorkPoint ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo004" ) ) ; //"站点不能为空!"
}
if ( TransType ! = TransTypeEnum . ContainerBind . GetDescription ( ) & & TransType ! = TransTypeEnum . ContainerUnBind . GetDescription ( ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo199" ) ) ; //"操作类型错误!"
}
string chksql = @ "select ID,ContainerCode from ICSContainer
where ContainerCode = ' { 0 } ' AND WorkPoint = ' { 1 } ' ";
chksql = string . Format ( chksql , JsonData . ContainerCode , JsonData . WorkPoint ) ;
DataTable chkdt = DBHelper . SQlReturnData ( chksql , cmd ) ;
if ( chkdt . Rows . Count = = 0 )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo195" ) , JsonData . ContainerCode ) ; //"容器不存在!"
}
else
{
ContainerID = chkdt . Rows [ 0 ] [ "ID" ] . ToString ( ) ;
}
if ( TransType = = TransTypeEnum . ContainerBind . GetDescription ( ) )
{
chksql = @ " select C.LotNo from ICSContainer A
INNER JOIN ICSContainerLot B ON B . ContainerID = A . ID AND B . WorkPoint = A . WorkPoint
INNER JOIN ICSWareHouseLotInfo C ON C . LotNo = B . LotNo AND C . WorkPoint = B . WorkPoint
WHERE A . ContainerCode = ' { 0 } ' AND A . WorkPoint = ' { 1 } ' ";
chksql = string . Format ( chksql , JsonData . ContainerCode , JsonData . WorkPoint ) ;
chkdt = DBHelper . SQlReturnData ( chksql , cmd ) ;
if ( chkdt . Rows . Count ! = 0 )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo196" ) , JsonData . ContainerCode ) ; //"容器已入库!"
}
}
else
{
chksql = @ "select LotNo from ICSContainerLot
where ContainerID = ' { 0 } ' AND WorkPoint = ' { 1 } ' ";
chksql = string . Format ( chksql , ContainerID , JsonData . WorkPoint ) ;
chkdt = DBHelper . SQlReturnData ( chksql , cmd ) ;
if ( chkdt . Rows . Count = = 0 )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo200" ) , JsonData . ContainerCode ) ; //"容器未绑定条码!"
}
else
{
string sql = @ "SELECT a.ID,
con . ContainerCode ,
con . ContainerName ,
a . LotNo ,
a . InvCode ,
inv . InvName ,
inv . InvStd ,
a . Quantity
FROM ICSWareHouseLotInfo a
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 bom . ContainerCode = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
sql = string . Format ( sql , JsonData . ContainerCode , JsonData . WorkPoint ) ;
log . Info ( "条码sql:" + sql ) ;
table = DBHelper . SQlReturnData ( sql , cmd ) ;
}
}
Result res = new Result ( ) ;
if ( msg = = "" )
{
if ( TransType = = TransTypeEnum . ContainerBind . GetDescription ( ) )
{
res . Success = true ;
res . Message = msg ; // "接口调用成功!";
}
else
{
res . Success = true ;
res . Message = msg ; // "接口调用成功!";
res . Data = table ;
}
}
else
{
res . Success = false ;
res . Message = msg ; // "返回错误信息!";
}
return res ;
}
catch ( Exception ex )
{
log . Error ( ex . Message ) ;
throw new Exception ( ex . Message ) ;
}
finally
{
if ( conn . State = = ConnectionState . Open )
{
conn . Close ( ) ;
}
conn . Dispose ( ) ;
}
}
}
#endregion
#region 条码信息
/// <summary>
/// 条码信息
@ -1193,10 +1319,10 @@ namespace ICSSoft.DataProject
WHERE bom . ContainerCode = ' { 2 } ' AND a . WorkPoint = ' { 3 } ' ";
}
}
#endregion
bool isOut = false ; //出库标记
string columns = string . Empty ; //查询源头单据表的特殊列名
@ -1222,7 +1348,7 @@ namespace ICSSoft.DataProject
| | TransType = = TransTypeEnum . OutsourcingReceiveDocNegative . GetDescription ( ) //开立委外红字入库单
| | TransType = = TransTypeEnum . BrrowDoc . GetDescription ( ) //借用
| | TransType = = TransTypeEnum . TransferLibrary . GetDescription ( ) //移库
//|| TransType == TransTypeEnum.DisassemblyDoc.GetDescription() //拆卸单(散件生成条码入库)
//|| TransType == TransTypeEnum.DisassemblyDoc.GetDescription() //拆卸单(散件生成条码入库)
)
{
isOut = true ;
@ -1230,17 +1356,17 @@ namespace ICSSoft.DataProject
//库位查询
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";
// 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,";
// 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 ";
// 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
@ -1694,6 +1820,25 @@ namespace ICSSoft.DataProject
LEFT JOIN ( SELECT EATTRIBUTE1 AS LotNo , WorkPoint , EATTRIBUTE1 + '-' + CAST ( ( MAX ( CAST ( SUBSTRING ( LotNo , CHARINDEX ( '-' , LotNo ) + 1 , LEN ( LotNo ) - CHARINDEX ( '-' , LotNo ) ) AS INT ) ) + 1 ) AS VARCHAR ) AS SplitLotNo FROM ICSInventoryLot GROUP BY EATTRIBUTE1 , WorkPoint ) split ON a . LotNo = split . LotNo AND a . WorkPoint = split . WorkPoint
LEFT JOIN ICSInventoryBatchEnable invBat ON a . InvCode = invBat . InvCode AND a . WarehouseCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint ";
}
else if ( TransType = = TransTypeEnum . LOTInfoGet . GetDescription ( ) )
{
sql = @ "IF EXISTS(SELECT a.ID FROM ICSWareHouseLotInfo a WHERE a.LotNo='{2}' AND a.WorkPoint='{3}' AND a.Quantity>0)
BEGIN
RAISERROR ( ' " + string.Format(language.GetNameByCode(" WMSAPIInfo039 "), " { 2 } ") + @" ' , 1 6 , 1 ) ;
RETURN
END
IF NOT EXISTS ( SELECT a . ID FROM ICSInventoryLot a WHERE a . LotNo = ' { 2 } ' AND a . WorkPoint = ' { 3 } ' )
BEGIN
RAISERROR ( ' " + string.Format(language.GetNameByCode(" WMSAPIInfo038 "), " { 2 } ") + @" ' , 1 6 , 1 ) ;
RETURN
END
" + sql;
columns = @"a.Quantity," ;
tableName = @ " ICSInventoryLot a
INNER JOIN ICSExtension ext ON ext . ID = a . ExtensionID AND ext . WorkPoint = a . WorkPoint ";
}
//出库条码
else if ( isOut )
{
@ -1780,7 +1925,7 @@ namespace ICSSoft.DataProject
if ( ScanType = = "LOTNO" )
{
sql = @ "
IF NOT EXISTS ( SELECT a . ID FROM ICSInventoryLot a WHERE a . LotNo = ' { 2 } ' AND a . WorkPoint = ' { 3 } ' )
BEGIN
@ -1817,20 +1962,20 @@ namespace ICSSoft.DataProject
LotTypesql = string . Format ( LotTypesql , JsonData . Code , JsonData . WorkPoint ) ;
DataTable dt = DBHelper . SQlReturnData ( LotTypesql , cmd ) ;
LotType = dt . Rows [ 0 ] [ "Type" ] . ToString ( ) ;
if ( mode . itemCode . Equals ( "LocationRemind01" ) )
{
{
columnsWHNAME = @ "
( SELECT Top 1 locat . LocationName from ICSWareHouseLotInfoLog log
LEFT JOIN ICSLocation locat on locat . LocationCode = log . ToLocationCode and log . WorkPoint = locat . WorkPoint where log . TransType = '2' and a . InvCode = log . InvCode AND a . WorkPoint = log . WorkPoint
ORDER BY log . Mtime desc ) AS LocationName , ";
}
else if ( mode . itemCode . Equals ( "LocationRemind02" ) )
{
}
else if ( mode . itemCode . Equals ( "LocationRemind02" ) )
{
columnsWHNAME = @ "
STUFF (
( SELECT DISTINCT ',' + LocationName
@ -1841,11 +1986,11 @@ namespace ICSSoft.DataProject
) , 1 , 1 , ' '
) AS LocationName , ";
}
else
{
columnsWHNAME = @ "
}
else
{
columnsWHNAME = @ "
STUFF (
( SELECT DISTINCT ',' + LocationName
from ICSLocation wh
@ -1854,19 +1999,21 @@ namespace ICSSoft.DataProject
FOR xml path ( ' ' )
) , 1 , 1 , ' '
) AS LocationName , ";
}
}
#region 根据条码类型找到单据仓库信息
if ( LotType . Equals ( "1" ) )
{ //生产退料
columnsWHCODE = @ "(SELECT negg.WHCODE FROM ICSMOApplyNegDetail neg LEFT JOIN ICSMOApplyNeg negg ON neg.ApplyNegCode=negg.ApplyNegCode
WHERE lotdd . TransCode = neg . ApplyNegCode AND lotdd . TransSequence = neg . Sequence AND lotdd . WorkPoint = neg . WorkPoint and negg . Type = '1' ) AS WHCode ";
} else if ( LotType . Equals ( "2" ) )
}
else if ( LotType . Equals ( "2" ) )
{ //委外退料
columnsWHCODE = @ "(SELECT negg.WHCODE FROM ICSOApplyNegDetail neg LEFT JOIN ICSOApplyNeg negg ON neg.OApplyNegCode=negg.OApplyNegCode
WHERE lotdd . TransCode = neg . OApplyNegCode AND lotdd . TransSequence = neg . Sequence AND lotdd . WorkPoint = neg . WorkPoint and negg . Type = '1' ) AS WHCode ";
} else if ( LotType . Equals ( "3" ) )
}
else if ( LotType . Equals ( "3" ) )
{ //工单
columnsWHCODE = @"(SELECT a.WHCode FROM ICSMO a WHERE a.MOCode=lotdd.TransCode AND a.Sequence=lotdd.TransSequence AND a.WorkPoint=lotdd.WorkPoint) AS WHCode" ;
}
@ -1999,13 +2146,13 @@ namespace ICSSoft.DataProject
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 ) ;
table = DBHelper . SQlReturnData ( Losql , cmd ) ;
}
else
{
@ -2013,10 +2160,10 @@ namespace ICSSoft.DataProject
log . Info ( "条码sql:" + sql ) ;
table = DBHelper . SQlReturnData ( sql , cmd ) ;
}
if ( table = = null | | table . Rows . Count < = 0 )
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo008" ) ) ; //"未查询到条码数据!"
#region 出库检验是否符合源头单据
string msg = string . Empty ;
bool isLimit = false ;
@ -2046,7 +2193,7 @@ namespace ICSSoft.DataProject
}
}
else if ( TransType ! = TransTypeEnum . LocationSeatch . GetDescription ( ) )
else if ( TransType ! = TransTypeEnum . LocationSeatch . GetDescription ( ) )
{
if ( string . IsNullOrEmpty ( JsonData . TransCode ) )
{
@ -2209,7 +2356,7 @@ namespace ICSSoft.DataProject
throw new Exception ( LanguageHelper . GetNameSingle ( "WMSAPIInfo003" ) ) ; //"单据类型不存在!"
}
string WHTransType = "2" ;
foreach ( var itemInfo in item . detail )
{
@ -2378,7 +2525,7 @@ namespace ICSSoft.DataProject
}
//入库
ICSWareHouseLotInfoService . WareHouseLotInfoUp ( Identification , itemInfo . LocationCode , itemInfo . LotNo , itemInfo . Quantity ,
item . User , item . WorkPoint , WHTransType , BusinessCode , cmd , language , itemInfo . LogID , itemInfo . InvCode + itemInfo . WarehouseCode ) ;
item . User , item . WorkPoint , WHTransType , BusinessCode , cmd , language , itemInfo . LogID , itemInfo . InvCode + itemInfo . WarehouseCode ) ;
}
}
@ -2423,7 +2570,7 @@ namespace ICSSoft.DataProject
ICSManufactureService . MOIssueDocNegativeERP ( TransType , Identification , cmd , language , BusinessCode ) ;
//生产入库
else if ( TransType = = TransTypeEnum . ManufactureReceiveDoc . GetDescription ( ) )
ICSManufactureService . ManufactureReceiveDocERP ( TransType , Identification , cmd , language , BusinessCode ) ;
ICSManufactureService . ManufactureReceiveDocERP ( TransType , Identification , cmd , language , BusinessCode ) ;
//开立的生产入库单
else if ( TransType = = TransTypeEnum . ManufactureReceive . GetDescription ( ) )
ICSManufactureService . ManufactureReceiveERP ( TransType , Identification , cmd , language , BusinessCode ) ;
@ -2525,7 +2672,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . PurchaseReceiveDoctNegative . GetDescription < DBValue > ( ) , cmd , language ) ;
}
}
@ -2540,7 +2687,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . OutsourcingIssueDoc . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -2570,7 +2717,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . MOIssueDoc . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -2615,7 +2762,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . OtherOutDoc . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -2646,7 +2793,7 @@ namespace ICSSoft.DataProject
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . OOApply . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
item . User , item . WorkPoint , "3" , TransTypeEnum . OOApply . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
#endregion
@ -2660,7 +2807,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . MOIssue . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -2675,7 +2822,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . OOIssue . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -2690,7 +2837,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . PurchaseReceive . GetDescription < DBValue > ( ) , cmd , language ) ;
}
}
@ -2705,7 +2852,7 @@ namespace ICSSoft.DataProject
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . OutsourcingReceiveDocNegative . GetDescription < DBValue > ( ) , cmd , language ) ;
}
}
@ -2716,11 +2863,11 @@ namespace ICSSoft.DataProject
BusinessCode = TransTypeEnum . BrrowDoc . GetDescription < DBValue > ( ) ;
//更新源头单据数量
ICSWareHouseService . BrrowDoc ( item . TransCode , item . TransSequence , item . Quantity , item . WorkPoint , cmd , language ) ;
foreach ( var itemInfo in item . detail )
{
//出库
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . BrrowDoc . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
@ -2736,7 +2883,7 @@ namespace ICSSoft.DataProject
{
//采购退货
if ( TransType = = TransTypeEnum . PurchaseReceiveDoctNegative . GetDescription ( ) )
ICSPurchaseService . PurchaseReceiveDoctNegativeERP ( TransType , Identification , cmd , language , BusinessCode ) ;
ICSPurchaseService . PurchaseReceiveDoctNegativeERP ( TransType , Identification , cmd , language , BusinessCode ) ;
//委外发料
else if ( TransType = = TransTypeEnum . OutsourcingIssueDoc . GetDescription ( ) )
ICSOutsourcingService . OutsourcingIssueDocERP ( TransType , Identification , cmd , language , BusinessCode ) ;
@ -2788,7 +2935,7 @@ namespace ICSSoft.DataProject
cmd . Transaction . Commit ( ) ;
return table ;
}
}
catch ( Exception ex )
{
@ -4734,7 +4881,7 @@ namespace ICSSoft.DataProject
ICSWareHouseService . OneStepTransferDocIn ( item . TransCode , item . TransSequence , item . WorkPoint , itemInfo . CurrentQuantity , cmd , language ) ;
//更新条码信息
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoTransfer ( Identification , item . TransCode , item . TransSequence , itemInfo . WarehouseCode , itemInfo . LocationCode ,
printTable = ICSWareHouseLotInfoService . WareHouseLotInfoTransfer ( Identification , item . TransCode , item . TransSequence , itemInfo . WarehouseCode , itemInfo . LocationCode ,
itemInfo . LotNo , itemInfo . CurrentQuantity , item . User , item . WorkPoint , "6" , TransTypeEnum . OneStepTransferDocIn . GetDescription < DBValue > ( ) , cmd , language , MergeID ) ;
}
}
@ -4751,7 +4898,7 @@ namespace ICSSoft.DataProject
cmd . Transaction . Commit ( ) ;
return table ;
}
}
catch ( Exception ex )
{
@ -4858,7 +5005,7 @@ namespace ICSSoft.DataProject
#endregion
#region 调拨申请单
/// <summary>
/// 调拨
@ -5585,7 +5732,7 @@ namespace ICSSoft.DataProject
sql = @ "SELECT a.ContainerCode, a.ContainerName,b.LotNo FROM ICSContainer a
INNER JOIN ICSContainerLot b ON a . ID = b . ContainerID
WHERE a . ContainerCODE + a . WorkPoint IN ( { 0 } ) ";
sql = string . Format ( sql , codes . Substring ( 0 , codes . Length - 1 ) ) ;
sql = string . Format ( sql , codes . Substring ( 0 , codes . Length - 1 ) ) ;
DataTable table = DBHelper . SQlReturnData ( sql , cmd ) ;
cmd . Transaction . Commit ( ) ;
return table ;
@ -6142,14 +6289,14 @@ namespace ICSSoft.DataProject
/// <returns></returns>
public static DataTable TransCodemationGet ( TransferDoc JsonData )
{
var language = LanguageHelper . GetName ( "WMSAPIInfo" ) ;
var language = LanguageHelper . GetName ( "WMSAPIInfo" ) ;
if ( JsonData = = null )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo007" ) ) ; //"传送数据为空!"
}
using ( SqlConnection conn = new System . Data . SqlClient . SqlConnection ( connString ) )
{
conn . Open ( ) ;
conn . Open ( ) ;
SqlTransaction sqlTran = conn . BeginTransaction ( ) ;
SqlCommand cmd = new SqlCommand ( ) ;
cmd . Transaction = sqlTran ;
@ -6161,7 +6308,7 @@ namespace ICSSoft.DataProject
string sql = @ "SELECT DISTINCT TransferNO as TransCode FROM ICSTransferApplication
WHERE WorkPoint = ' { 0 } ' AND Quantity > ISNULL ( TransferQuantity , 0 ) order by TransferNO desc ";
sql = string . Format ( sql , Workpoint ) ;
sql = string . Format ( sql , Workpoint ) ;
DataTable table = DBHelper . SQlReturnData ( sql , cmd ) ;
return table ;
@ -6185,6 +6332,79 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
#endregion
#region 料架条码绑定/解绑
/// <summary>
/// 料架条码绑定
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static Result ContainerBindCreate ( List < ICSContainerBind > JsonData )
{
var language = LanguageHelper . GetName ( "WMSAPIInfo" ) ;
DataTable table = new DataTable ( ) ;
string msg = "" ;
using ( SqlConnection conn = new System . Data . SqlClient . SqlConnection ( connString ) )
{
conn . Open ( ) ;
SqlCommand cmd = new SqlCommand ( ) ;
cmd . Connection = conn ;
try
{
foreach ( ICSContainerBind item in JsonData )
{
string TransType = item . TransType ;
if ( JsonData . Count < = 0 )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo007" ) ) ; //"传入数据为空!"
}
if ( String . IsNullOrEmpty ( item . WorkPoint ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo004" ) ) ; //"站点不能为空!"
}
if ( String . IsNullOrEmpty ( item . LotNo ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo005" ) ) ; //"条码不能为空!"
}
if ( String . IsNullOrEmpty ( item . ContainerCode ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo197" ) ) ; //"料架不能为空!"
}
if ( TransType ! = TransTypeEnum . ContainerBind . GetDescription ( ) & & TransType ! = TransTypeEnum . ContainerUnBind . GetDescription ( ) )
{
msg = string . Format ( language . GetNameByCode ( "WMSAPIInfo199" ) ) ; //"操作类型错误!"
}
if ( TransType = = TransTypeEnum . ContainerBind . GetDescription ( ) )
{
//料架条码绑定
ICSWareHouseLotInfoService . ContainerBind ( item . LotNo , item . ContainerCode , item . ContainerType , item . User , item . WorkPoint , cmd , language ) ;
}
else
{
//料架条码解绑
ICSWareHouseLotInfoService . ContainerUnBind ( item . ContainerCode , item . WorkPoint , cmd , language ) ;
}
}
Result res = new Result ( ) ;
res . Success = true ;
res . Message = msg ; // "接口调用成功!";
return res ;
}
catch ( Exception ex )
{
log . Error ( ex . Message ) ;
throw new Exception ( ex . Message ) ;
}
finally
{
if ( conn . State = = ConnectionState . Open )
{
conn . Close ( ) ;
}
conn . Dispose ( ) ;
}
}
}
#endregion
}
}