@ -4889,12 +4889,32 @@ a.ExtensionID
else if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) )
else if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) )
{
{
BusinessCode = TransTypeEnum . MOIssueDoc . GetDescription < DBValue > ( ) ;
BusinessCode = TransTypeEnum . MOIssueDoc . GetDescription < DBValue > ( ) ;
//更新源头单据数量
ICSManufactureService . AMMOIssueDoc ( item . TransCode , item . TransSequence , item . Quantity , item . WorkPoint , cmd , language , enableCode ) ;
//工单行查子件信息
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 , item . TransCode , item . WorkPoint , item . TransSequence ) ;
log . Debug ( "工单行查子件信息" + chekkksql ) ;
DataTable dtaa = DBHelper . SQlReturnData ( chekkksql , cmd ) ;
//ICSManufactureService.AMMOIssueDoc(item.TransCode, item.TransSequence, item.Quantity, item.WorkPoint, cmd, language, enableCode);
foreach ( var itemInfo in item . detail )
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());
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 ( ) ;
log . Debug ( "工单子件行号:" + seq ) ;
//判断是否开启辅计量,计算辅计量比例
string chekksql = @ "select c.EATTRIBUTE1 FROM ICSMOPick a
string chekksql = @ "select c.EATTRIBUTE1 FROM ICSMOPick a
INNER JOIN ICSMO b ON a . MODetailID = b . MODetailID AND a . WorkPoint = b . WorkPoint
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
INNER JOIN ICSInventory c on a . InvCode = c . InvCode and a . WorkPoint = c . WorkPoint
@ -4905,7 +4925,10 @@ a.ExtensionID
{
{
itemInfo . CurrentQuantity = ( decimal . Parse ( itemInfo . CurrentQuantity ) * decimal . Parse ( dta . Rows [ 0 ] [ "EATTRIBUTE1" ] . ToString ( ) ) ) . ToString ( ) ;
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 ,
//更新源头单据数量
ICSManufactureService . AMMOIssueDoc ( item . TransCode , seq , itemInfo . CurrentQuantity , item . WorkPoint , cmd , language , enableCode ) ;
//出库
printTable = ICSWareHouseLotInfoService . AMWareHouseLotInfoDown ( Identification , item . TransCode , seq , itemInfo . LotNo , itemInfo . CurrentQuantity ,
item . User , item . WorkPoint , "3" , TransTypeEnum . MOIssueDoc . GetDescription < DBValue > ( ) , cmd , language , itemInfo . LogID , MergeID ) ;
item . User , item . WorkPoint , "3" , TransTypeEnum . MOIssueDoc . GetDescription < DBValue > ( ) , cmd , language , itemInfo . LogID , MergeID ) ;
}
}
}
}
@ -12158,6 +12181,7 @@ END";
cmd . Connection = conn ;
cmd . Connection = conn ;
cmd . CommandTimeout = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "TimeOut" ] ) ;
cmd . CommandTimeout = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "TimeOut" ] ) ;
string UserName = "" ;
string UserName = "" ;
string WarehouseCode = "" ;
try
try
{
{
//检验是否分批
//检验是否分批
@ -12174,33 +12198,47 @@ END";
UserName = dt . Rows [ 0 ] [ "F_RealName" ] . ToString ( ) ;
UserName = dt . Rows [ 0 ] [ "F_RealName" ] . ToString ( ) ;
}
}
string UName = UserName . Substring ( 0 , 2 ) ;
string UName = UserName . Substring ( 0 , 2 ) ;
switch ( UName )
{
case "L1" :
UName = "021" ;
break ;
case "L2" :
UName = "022" ;
break ;
case "L3" :
UName = "023" ;
break ;
case "L4" :
UName = "024" ;
break ;
case "L5" :
UName = "025" ;
break ;
case "L6" :
UName = "026" ;
break ;
case "L7" :
UName = "025" ;
break ;
case "C1" :
UName = "004" ;
break ;
string waresql = @ "select WarehouseCode,WarehouseName from ICSWarehouse
where SUBSTRING ( WarehouseName , 1 , 2 ) = ' { 0 } ' and WorkPoint = ' { 1 } ' ";
waresql = string . Format ( waresql , UName , JsonData . WorkPoint ) ;
DataTable dta = DBHelper . SQlReturnData ( waresql , cmd ) ;
if ( dta . Rows . Count = = 0 )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo369" ) ) ;
}
else
{
UName = dta . Rows [ 0 ] [ "WarehouseCode" ] . ToString ( ) ;
}
}
//switch (UName)
//{
// case "L1":
// UName = "021";
// break;
// case "L2":
// UName = "022";
// break;
// case "L3":
// UName = "023";
// break;
// case "L4":
// UName = "024";
// break;
// case "L5":
// UName = "025";
// break;
// case "L6":
// UName = "026";
// break;
// case "L7":
// UName = "025";
// break;
// case "C1":
// UName = "015";
// break;
//}
string sql = @ "IF NOT EXISTS(SELECT LocationCode FROM ICSLocation a where LocationCode like '%{0}%' AND a.WorkPoint='{1}')
string sql = @ "IF NOT EXISTS(SELECT LocationCode FROM ICSLocation a where LocationCode like '%{0}%' AND a.WorkPoint='{1}')
BEGIN
BEGIN
RAISERROR ( ' " + language.GetNameByCode(" WMSAPIInfo070 ") + @" ' , 1 6 , 1 ) ;
RAISERROR ( ' " + language.GetNameByCode(" WMSAPIInfo070 ") + @" ' , 1 6 , 1 ) ;
@ -14245,7 +14283,7 @@ a.ExtensionID
INNER JOIN ICSMO b ON a . MODetailID = b . MODetailID AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSMO b ON a . MODetailID = b . MODetailID AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSDepartment dd on b . DepCode = dd . DepCode and b . WorkPoint = dd . WorkPoint ";
INNER JOIN ICSDepartment dd on b . DepCode = dd . DepCode and b . WorkPoint = dd . WorkPoint ";
where = @" b.MOCode='{0}' AND a.WorkPoint='{1}' AND a.SupplyType='3' AND b.MOStatus<>'3' and a.EATTRIBUTE1<>'1' AND b.Sequence+'~'+a.Sequence='{3}' AND dd.DepName =(SELECT SUBSTRING(F_RealName, 1, 2) FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')" ;
where = @" b.MOCode='{0}' AND a.WorkPoint='{1}' AND a.SupplyType='3' AND b.MOStatus<>'3' and a.EATTRIBUTE1<>'1' AND dd.DepName =(SELECT SUBSTRING(F_RealName, 1, 2) FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')" ;
}
}
#endregion
#endregion
#region 销售出库(合并发料)
#region 销售出库(合并发料)
@ -16047,47 +16085,57 @@ a.ExtensionID
| | TransType = = TransTypeEnum . BrrowDoc . GetDescription ( ) | | TransType = = TransTypeEnum . StepTransferDocIn . GetDescription ( )
| | TransType = = TransTypeEnum . BrrowDoc . GetDescription ( ) | | TransType = = TransTypeEnum . StepTransferDocIn . GetDescription ( )
| | TransType = = TransTypeEnum . TwoStepTransferDocOut . GetDescription ( ) | | TransType = = TransTypeEnum . MOReplenishment . GetDescription ( ) )
| | TransType = = TransTypeEnum . TwoStepTransferDocOut . GetDescription ( ) | | TransType = = TransTypeEnum . MOReplenishment . GetDescription ( ) )
{
{
string uersql = @ "SELECT F_RealName from Sys_SRM_User where F_Account='{0}' AND F_Location='{1}'
if ( TransType = = TransTypeEnum . MOIssueDoc . GetDescription ( ) )
{
string uersql = @ "SELECT F_RealName from Sys_SRM_User Where F_Account='{0}' AND F_Location='{1}'
";
";
uersql = string . Format ( uersql , JsonData . User , JsonData . WorkPoint ) ;
uersql = string . Format ( uersql , JsonData . User , JsonData . WorkPoint ) ;
DataTable dt = DBHelper . SQlReturnData ( uersql , cmd ) ;
DataTable dt = DBHelper . SQlReturnData ( uersql , cmd ) ;
if ( dt . Rows . Count = = 0 )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo369" ) ) ;
}
else
if ( dt . Rows . Count > = 0 )
{
{
UserName = dt . Rows [ 0 ] [ "F_RealName" ] . ToString ( ) ;
UserName = dt . Rows [ 0 ] [ "F_RealName" ] . ToString ( ) ;
}
}
UName = UserName . Substring ( 0 , 2 ) ;
UName = UserName . Substring ( 0 , 2 ) ;
switch ( UName )
{
case "L1" :
UName = "021" ;
break ;
case "L2" :
UName = "022" ;
break ;
case "L3" :
UName = "023" ;
break ;
case "L4" :
UName = "024" ;
break ;
case "L5" :
UName = "025" ;
break ;
case "L6" :
UName = "026" ;
break ;
case "L7" :
UName = "025" ;
break ;
case "C1" :
UName = "004" ;
break ;
string waresql = @ "select WarehouseCode,WarehouseName from ICSWarehouse
where SUBSTRING ( WarehouseName , 1 , 2 ) = ' { 0 } ' and WorkPoint = ' { 1 } ' ";
waresql = string . Format ( waresql , UName , JsonData . WorkPoint ) ;
DataTable dta = DBHelper . SQlReturnData ( waresql , cmd ) ;
if ( dta . Rows . Count > = 0 )
{
UName = dta . Rows [ 0 ] [ "WarehouseCode" ] . ToString ( ) ;
}
}
}
//switch (UName)
//{
// case "L1":
// UName = "021";
// break;
// case "L2":
// UName = "022";
// break;
// case "L3":
// UName = "023";
// break;
// case "L4":
// UName = "024";
// break;
// case "L5":
// UName = "025";
// break;
// case "L6":
// UName = "026";
// break;
// case "L7":
// UName = "025";
// break;
// case "C1":
// UName = "015";
// break;
//}
ZLtable = ICSControlModeService . GetZL ( ) ;
ZLtable = ICSControlModeService . GetZL ( ) ;
if ( ZLtable = = null )
if ( ZLtable = = null )
{
{
@ -16627,7 +16675,9 @@ a.ExtensionID
}
}
else
else
{
{
sql = string . Format ( sql , columns , tableName , JsonData . Code , JsonData . WorkPoint , zlqty , UName , JsonData . TransCode , JsonData . TransSequence ) ;
sql = string . Format ( sql , columns , tableName , JsonData . Code , JsonData . WorkPoint , zlqty , UName , JsonData . TransCode , JsonData . TransSequence ) ;
log . Debug ( "条码sql:" + sql ) ;
table = DBHelper . SQlReturnData ( sql , cmd ) ;
table = DBHelper . SQlReturnData ( sql , cmd ) ;
}
}