@ -2087,10 +2087,10 @@ a.ExtensionID
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 } '
select @bb = id from ICSLocation where LocationCode like ' % { 2 } % '
IF @bb IS not NULL
BEGIN
set @wheresql = ' and a . locationcode = s . locationcode and a . LocationCode = ' ' { 2 } ' ' '
set @wheresql = ' and a . locationcode = s . locationcode and a . LocationCode like ' ' % { 2 } % ' ' '
set @groupsql = ' group by inv . LotEnable , a . ID , con . ContainerCode , con . ContainerName , a . LotNo , a . InvCode , inv . InvName , inv . InvStd , inv . InvUnit , inv . LotEnable , a . warehouseCode , a . LocationCode , inv . INVCODE , inv . INVNAME , inv . INVSTD , a . Quantity , 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
@ -3182,7 +3182,7 @@ a.ExtensionID
| | TransType = = TransTypeEnum . MOStockINByProduct . GetDescription ( ) | | TransType = = TransTypeEnum . OtherInDoc . GetDescription ( ) ) & & needIns )
{
columns = @ "ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
{ 0 } , { 2 } ,
lotdd . TransCode , lotdd . TransSequence ,
a . Type ,
@ -3198,7 +3198,7 @@ a.ExtensionID
else
{
columns = @ "a.Quantity AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
{ 0 } , { 2 } ,
a . Type ,
{ 3 }
@ -3255,7 +3255,7 @@ a.ExtensionID
| | TransType = = TransTypeEnum . OOStockINByProduct . GetDescription ( ) | | TransType = = TransTypeEnum . OtherInDoc . GetDescription ( ) ) & & needIns )
{
columns = @ "ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
' ' AS WHCode ,
' ' AS WHName ,
' ' AS LocationCode ,
@ -3269,7 +3269,7 @@ a.ExtensionID
else
{
columns = @ "a.Quantity AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
' ' AS WHCode ,
' ' AS WHName ,
' ' AS LocationCode ,
@ -4909,17 +4909,26 @@ a.ExtensionID
DataTable lotdata = DBHelper . SQlReturnData ( cheklotsql , cmd ) ;
//DataTable ad0=dtaa.Select(a => a.invcode == lotdata.Rows[0]["InvCode"].ToString());
DataTable ad0 = dtaa . AsEnumerable ( )
. Where ( a = > a . Field < string > ( "InvCode" ) = = lotdata . Rows [ 0 ] [ "InvCode" ] . ToString ( ) )
. CopyToDataTable ( ) ;
string seq = item . TransSequence + "~" + ad0 . Rows [ 0 ] [ "Sequence" ] . ToString ( ) ;
DataRow [ ] drs = dtaa . Select ( "InvCode ='" + lotdata . Rows [ 0 ] [ "InvCode" ] . ToString ( ) + "'" ) ;
if ( drs = = null | | drs . Length = = 0 )
{
throw new Exception ( "当前扫描的条码物料和单据子件物料没有匹配的行,请确认!" ) ;
}
//DataTable ad0 = dtaa.AsEnumerable()
//.Where(a => a.Field<string>("InvCode") == lotdata.Rows[0]["InvCode"].ToString())
//.CopyToDataTable();
//if (ad0 == null || ad0.Rows.Count == 0)
//{
// throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
//}
string seq = item . TransSequence + "~" + drs [ 0 ] [ "Sequence" ] . ToString ( ) ;
log . Debug ( "工单子件行号:" + seq ) ;
//判断是否开启辅计量,计算辅计量比例
string chekksql = @ "select c.EATTRIBUTE1 FROM ICSMOPick a
INNER JOIN ICSMO b ON a . MODetailID = b . MODetailID AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSInventory c on a . InvCode = c . InvCode and a . WorkPoint = c . WorkPoint
WHERE b . MOCode = ' { 0 } ' AND b . Sequence + '~' + a . Sequence = ' { 3 } ' AND a . WorkPoint = ' { 1 } ' and c . AmountEnable = '1' ";
chekksql = string . Format ( chekksql , item . TransCode , item . WorkPoint , itemInfo . CurrentQuantity , item . TransSequence ) ;
chekksql = string . Format ( chekksql , item . TransCode , item . WorkPoint , itemInfo . CurrentQuantity , s eq) ;
DataTable dta = DBHelper . SQlReturnData ( chekksql , cmd ) ;
if ( dta . Rows . Count > 0 )
{
@ -4937,13 +4946,41 @@ a.ExtensionID
else if ( TransType = = TransTypeEnum . SalesShipmentDoc . GetDescription ( ) )
{
BusinessCode = TransTypeEnum . SalesShipmentDoc . GetDescription < DBValue > ( ) ;
//更新源头单据数量
ICSSalesService . AMSalesShipmentDoc ( item . TransCode , item . TransSequence , item . Quantity , item . WorkPoint , cmd , language ) ;
foreach ( var itemInfo in item . detail )
{
//出库
//出库
string chekkksql = @ "select a.Sequence,a.InvCode FROM ICSSDN a
WHERE a . SDNCode = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
chekkksql = string . Format ( chekkksql , item . TransCode , item . WorkPoint ) ;
log . Debug ( "销售发货单行信息" + chekkksql ) ;
DataTable dtaa = DBHelper . SQlReturnData ( chekkksql , cmd ) ;
foreach ( var itemInfo in item . detail )
{
//查询条码的物料
string cheklotsql = @ "select a.InvCode FROM ICSInventoryLot a
WHERE a . LotNo = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
cheklotsql = string . Format ( cheklotsql , itemInfo . LotNo , item . WorkPoint ) ;
log . Debug ( "查询条码的物料" + cheklotsql ) ;
DataTable lotdata = DBHelper . SQlReturnData ( cheklotsql , cmd ) ;
//DataTable ad0=dtaa.Select(a => a.invcode == lotdata.Rows[0]["InvCode"].ToString());
DataRow [ ] drs = dtaa . Select ( "InvCode ='" + lotdata . Rows [ 0 ] [ "InvCode" ] . ToString ( ) + "'" ) ;
if ( drs = = null | | drs . Length = = 0 )
{
throw new Exception ( "当前扫描的条码物料和单据物料没有匹配的行,请确认!" ) ;
}
//DataTable ad0 = dtaa.AsEnumerable()
//.Where(a => a.Field<string>("InvCode") == lotdata.Rows[0]["InvCode"].ToString())
//.CopyToDataTable();
//if (ad0 == null || ad0.Rows.Count == 0)
//{
// throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
//}
string seq = drs [ 0 ] [ "Sequence" ] . ToString ( ) ;
log . Debug ( "销售发货单行号:" + seq ) ;
string chekksql = @ "select c.EATTRIBUTE1 FROM ICSSDN a
INNER JOIN ICSInventory c on a . InvCode = c . InvCode and a . WorkPoint = c . WorkPoint
WHERE a . SDNCode = ' { 0 } ' AND a . Sequence = ' { 2 } ' AND a . WorkPoint = ' { 1 } ' and c . AmountEnable = '1' ";
@ -4953,7 +4990,10 @@ a.ExtensionID
{
itemInfo . CurrentQuantity = ( decimal . Parse ( itemInfo . CurrentQuantity ) * decimal . Parse ( dta . Rows [ 0 ] [ "EATTRIBUTE1" ] . ToString ( ) ) ) . ToString ( ) ;
}
printTable = ICSWareHouseLotInfoService . AMWareHouseLotInfoDown ( Identification , item . TransCode , item . TransSequence , itemInfo . LotNo , itemInfo . CurrentQuantity ,
//更新源头单据数量
ICSSalesService . AMSalesShipmentDoc ( item . TransCode , seq , itemInfo . CurrentQuantity , item . WorkPoint , cmd , language ) ;
printTable = ICSWareHouseLotInfoService . AMWareHouseLotInfoDown ( Identification , item . TransCode , seq , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . SalesShipmentDoc . GetDescription < DBValue > ( ) , cmd , language , itemInfo . LogID , MergeID ) ;
}
}
@ -9917,6 +9957,17 @@ END";
foreach ( var itemInfo in item . Detail )
{
//判断是否开启辅计量,计算辅计量比例
string chekksql = @ "select c.EATTRIBUTE1 FROM ICSInventoryLot a
INNER JOIN ICSInventory c on a . InvCode = c . InvCode and a . WorkPoint = c . WorkPoint
WHERE a . lotno = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' and c . AmountEnable = '1' ";
chekksql = string . Format ( chekksql , itemInfo . LotNo , item . WorkPoint , itemInfo . CurrentQuantity ) ;
DataTable dta = DBHelper . SQlReturnData ( chekksql , cmd ) ;
if ( dta . Rows . Count > 0 )
{
itemInfo . CurrentQuantity = ( decimal . Parse ( itemInfo . CurrentQuantity ) * decimal . Parse ( dta . Rows [ 0 ] [ "EATTRIBUTE1" ] . ToString ( ) ) ) . ToString ( ) ;
}
//验证仓库库位信息
sql = @ "IF NOT EXISTS(SELECT a.ID FROM ICSWareHouse a WHERE a.WarehouseCode='{0}' AND a.WorkPoint='{1}')
BEGIN
@ -15946,7 +15997,7 @@ a.ExtensionID
#region 原条码
if ( ScanType = = "LOTNO" )
{
sql = sql + @" AND log.BusinessCode IN('" + type + @ "') GROUP BY inv.LotEnable,log.ID,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode,
sql = sql + @" AND log.BusinessCode IN('" + type + @ "') GROUP BY inv.AmountEnable,inv. LotEnable,log.ID,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 ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , 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
";
@ -15987,7 +16038,7 @@ a.ExtensionID
}
else
{
sql = sql + @" AND log.BusinessCode IN('" + type + @ "') GROUP BY inv.LotEnable,log.ID,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,a.WarehouseCode,
sql = sql + @" AND log.BusinessCode IN('" + type + @ "') GROUP BY inv.AmountEnable,inv. LotEnable,log.ID,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 ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , 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
";
@ -16086,7 +16137,7 @@ a.ExtensionID
| | TransType = = TransTypeEnum . TwoStepTransferDocOut . GetDescription ( ) | | TransType = = TransTypeEnum . MOReplenishment . GetDescription ( ) )
{
if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) )
if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) & & JsonData . User ! = "admin" )
{
string uersql = @ "SELECT F_RealName from Sys_SRM_User Where F_Account='{0}' AND F_Location='{1}'
";
@ -16558,7 +16609,7 @@ a.ExtensionID
| | TransType = = TransTypeEnum . OOStockINByProduct . GetDescription ( ) )
{
columns = @ "ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
{ 0 } , { 2 } ,
lotdd . TransCode , lotdd . TransSequence ,
{ 3 }
@ -16573,7 +16624,7 @@ a.ExtensionID
else
{
columns = @ "a.Quantity AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
{ 0 } , { 2 } ,
{ 3 }
{ 1 }
@ -16629,7 +16680,7 @@ a.ExtensionID
| | TransType = = TransTypeEnum . OOStockINByProduct . GetDescription ( ) )
{
columns = @ "ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
' ' AS WHCode ,
' ' AS WHName ,
' ' AS LocationCode ,
@ -16643,7 +16694,7 @@ a.ExtensionID
else
{
columns = @ "a.Quantity AS Quantity,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount ,
a . Quantity * ( a . Amount / a . Quantity ) AS Amount , a . Type ,
' ' AS WHCode ,
' ' AS WHName ,
' ' AS LocationCode ,
@ -16716,14 +16767,82 @@ a.ExtensionID
}
else if ( TransType ! = TransTypeEnum . LocationSeatch . GetDescription ( ) & & TransType ! = TransTypeEnum . StepNoTransferDocIn . GetDescription ( ) )
{
string seq = string . Empty ;
if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) )
{
string chekkksql = @ "select a.Sequence,a.InvCode FROM ICSMOPick a
INNER JOIN ICSMO b ON a . MODetailID = b . MODetailID AND a . WorkPoint = b . WorkPoint
WHERE b . MOCode = ' { 0 } ' AND b . Sequence = ' { 2 } ' AND a . WorkPoint = ' { 1 } ' ";
chekkksql = string . Format ( chekkksql , JsonData . TransCode , JsonData . WorkPoint , JsonData . TransSequence ) ;
log . Debug ( "工单行查子件信息" + chekkksql ) ;
DataTable dtaa = DBHelper . SQlReturnData ( chekkksql , cmd ) ;
//查询条码的物料
string cheklotsql = @ "select a.InvCode FROM ICSInventoryLot a
WHERE a . LotNo = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
cheklotsql = string . Format ( cheklotsql , table . Rows [ 0 ] [ "LotNo" ] . ToString ( ) , JsonData . WorkPoint ) ;
log . Debug ( "查询条码的物料" + cheklotsql ) ;
DataTable lotdata = DBHelper . SQlReturnData ( cheklotsql , cmd ) ;
//DataTable ad0=dtaa.Select(a => a.invcode == lotdata.Rows[0]["InvCode"].ToString());
DataRow [ ] drs = dtaa . Select ( "InvCode ='" + lotdata . Rows [ 0 ] [ "InvCode" ] . ToString ( ) + "'" ) ;
if ( drs = = null | | drs . Length = = 0 )
{
throw new Exception ( "当前扫描的条码物料和单据子件物料没有匹配的行,请确认!" ) ;
}
//DataTable ad0 = dtaa.AsEnumerable()
//.Where(a => a.Field<string>("InvCode") == lotdata.Rows[0]["InvCode"].ToString())
//.CopyToDataTable();
//if (ad0 == null || ad0.Rows.Count == 0)
//{
// throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
//}
seq = JsonData . TransSequence + "~" + drs [ 0 ] [ "Sequence" ] . ToString ( ) ;
log . Debug ( "工单子件行号:" + seq ) ;
if ( string . IsNullOrEmpty ( JsonData . TransCode ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo001" ) ) ; //"单据号不能为空!"
}
}
else if ( TransType = = TransTypeEnum . SalesShipmentDoc . GetDescription ( ) )
{
string chekkksql = @ "select a.Sequence,a.InvCode FROM ICSSDN a
WHERE a . SDNCode = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
chekkksql = string . Format ( chekkksql , JsonData . TransCode , JsonData . WorkPoint ) ;
log . Debug ( "销售发货单行信息" + chekkksql ) ;
DataTable dtaa = DBHelper . SQlReturnData ( chekkksql , cmd ) ;
//查询条码的物料
string cheklotsql = @ "select a.InvCode FROM ICSInventoryLot a
WHERE a . LotNo = ' { 0 } ' AND a . WorkPoint = ' { 1 } ' ";
cheklotsql = string . Format ( cheklotsql , table . Rows [ 0 ] [ "LotNo" ] . ToString ( ) , JsonData . WorkPoint ) ;
log . Debug ( "查询条码的物料" + cheklotsql ) ;
DataTable lotdata = DBHelper . SQlReturnData ( cheklotsql , cmd ) ;
//DataTable ad0=dtaa.Select(a => a.invcode == lotdata.Rows[0]["InvCode"].ToString());
DataRow [ ] drs = dtaa . Select ( "InvCode ='" + lotdata . Rows [ 0 ] [ "InvCode" ] . ToString ( ) + "'" ) ;
if ( drs = = null | | drs . Length = = 0 )
{
throw new Exception ( "当前扫描的条码物料和单据物料没有匹配的行,请确认!" ) ;
}
//DataTable ad0 = dtaa.AsEnumerable()
//.Where(a => a.Field<string>("InvCode") == lotdata.Rows[0]["InvCode"].ToString())
//.CopyToDataTable();
//if (ad0 == null || ad0.Rows.Count == 0)
//{
// throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
//}
seq = drs [ 0 ] [ "Sequence" ] . ToString ( ) ;
log . Debug ( "销售发货单行号:" + seq ) ;
if ( string . IsNullOrEmpty ( JsonData . TransCode ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo001" ) ) ; //"单据号不能为空!"
}
}
WMSSourceDocumentModel model = new WMSSourceDocumentModel ( ) ;
model . TransCode = JsonData . TransCode ;
model . TransSequence = JsonData . TransSequence ;
model . TransSequence = seq ;
model . TransType = JsonData . TransType ;
model . WorkPoint = JsonData . WorkPoint ;
model . User = JsonData . User ;