CatMaoo 12 months ago
parent
commit
4d120c18f1
  1. 2
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs
  2. 208
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  3. 4
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

2
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs

@ -161,7 +161,7 @@ from ICSWareHouseLotInfoLog
WHERE Identification='{0}' AND ERPUpload='0' AND BusinessCode = '13'
SELECT y.DepCode+a.FromWarehouseCode+y.MOCode+a.MUSER AS Costre,y.DepCode,a.FromWarehouseCode AS WarehouseCode,y.MOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.DepCode,a.FromWarehouseCode,y.MOCode,x.PickID,a.InvCode) AS Sequence,
a.InvCode,SUM(a.Quantity) AS Quantity,CASE inv.AmountEnable WHEN '1' THEN SUM(a.Quantity*(x.Amount/x.Quantity)) ELSE '0' END AS Amount,x.PickID,con.Enable AS UpdateTodoQuantity,conStock.Enable AS UpdateStock
a.InvCode,SUM(a.Quantity) AS Quantity,CASE inv.AmountEnable WHEN '1' THEN SUM(a.Quantity*(lot.Amount/lot.Quantity)) ELSE '0' END AS Amount,x.PickID,con.Enable AS UpdateTodoQuantity,conStock.Enable AS UpdateStock
,a.WorkPoint,ISNULL(ext.ProjectCode, '') AS ProjectCode,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode,ISNULL(ext.Version, '') AS Version,ISNULL(ext.Brand, '') AS Brand,
ISNULL(ext.cFree1, '') AS cFree1,ISNULL(ext.cFree2, '') AS cFree2,ISNULL(ext.cFree3, '') AS cFree3,ISNULL(ext.cFree4, '') AS cFree4,ISNULL(ext.cFree5, '') AS cFree5,ISNULL(ext.cFree6, '') AS cFree6,ISNULL(ext.cFree7, '') AS cFree7,ISNULL(ext.cFree8, '') AS cFree8,ISNULL(ext.cFree9, '') AS cFree9,ISNULL(ext.cFree10, '') AS cFree10,conv.Enable AS CompleteVerification
,'1'as DocTypeCode

208
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs

@ -17353,27 +17353,14 @@ a.ExtensionID
item.TransCode = trans[1];
}
#region 销售出库
else if (TransType == TransTypeEnum.SalesShipmentDoc.GetDescription()
|| TransType == TransTypeEnum.MOIssueDoc.GetDescription()
|| TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
else if (TransType == TransTypeEnum.SalesShipmentDoc.GetDescription())
{
BusinessCode = TransTypeEnum.SalesShipmentDoc.GetDescription<DBValue>();
// //更新源头单据数量
// pikTbLogsql = @"update b set b.LockQuantity=convert(decimal(18,6),b.LockQuantity)-convert(decimal(18,6),c.Quantity )
// from dbo.ICSWareHouseLotInfo b
// inner join (select sum(Quantity) as Quantity, LotNo from ICSWareHouseLotInfolog
// where TransCode ='{0}' AND TransSequence='{1}' and TransType='15' and WorkPoint='{2}' group by LotNo) c
// on c.LotNo =b.LotNo
//";
// pikTbLogsql = string.Format(pikTbLogsql, item.TransCode, item.TransSequence, item.WorkPoint);
// if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
// {
// throw new Exception("更新库存锁定数量失败!");
// }
foreach (var itemInfo in item.detail)
{
pikTbLogsql += @"
pikTbLogsql = @"
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{7}' AND a.WorkPoint='{6}' AND Quantity-LockQuantity-'{3}'<0)
BEGIN
RAISERROR(':" + "{7}" + @"',16,1);
@ -17395,8 +17382,91 @@ a.ExtensionID
WHERE a.LotNo='{7}' AND a.WorkPoint='{6}'
update ICSWareHouseLotInfo set LockQuantity=LockQuantity+'{3}' where LotNo='{7}' AND WorkPoint='{6}'
END ";
pikTbLogsql = string.Format(pikTbLogsql, Identification, item.TransCode, item.TransSequence, itemInfo.CurrentQuantity
, BusinessCode, item.User, item.WorkPoint, itemInfo.LotNo);
log.Debug("1");
if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
{
throw new Exception("拣料失败!");
}
}
}
#endregion
#region 材料出库
else if ( TransType == TransTypeEnum.MOIssueDoc.GetDescription()
)
{
BusinessCode = TransTypeEnum.MOIssueDoc.GetDescription<DBValue>();
foreach (var itemInfo in item.detail)
{
pikTbLogsql = @"
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{7}' AND a.WorkPoint='{6}' AND Quantity-LockQuantity-'{3}'<0)
BEGIN
RAISERROR(':" + "{7}" + @"',16,1);
RETURN
END
IF NOT EXISTS(SELECT TransCode FROM ICSWareHouseLotInfoLog WHERE TransCode='{1}' AND TransSequence='{2}' AND LotNo='{7}' AND WorkPoint='{6}' AND TransType='15')
BEGIN
INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
MTIME,WorkPoint,EATTRIBUTE1)
SELECT NEWID(),'{0}','{1}','{2}',a.LotNo ,a.InvCode ,
a.WarehouseCode,a.LocationCode,'','','{3}',
'','1','15','{4}','0','',
'','','','{5}' ,(select Top 1 f.F_RealName FROM ICSInventoryLot a INNER JOIN Sys_SRM_User f ON f.F_Account='{5}' AND a.WorkPoint=f.F_Location) ,
SYSDATETIME() ,'{6}' ,''
FROM ICSWareHouseLotInfo a
WHERE a.LotNo='{7}' AND a.WorkPoint='{6}'
update ICSWareHouseLotInfo set LockQuantity=LockQuantity+'{3}' where LotNo='{7}' AND WorkPoint='{6}'
END ";
pikTbLogsql = string.Format(pikTbLogsql, Identification, item.TransCode, item.TransSequence, itemInfo.CurrentQuantity
, BusinessCode, item.User, item.WorkPoint, itemInfo.LotNo);
log.Debug("1");
if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
{
throw new Exception("拣料失败!");
}
}
}
#endregion
#region 委外发料
else if (TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
{
BusinessCode = TransTypeEnum.OutsourcingIssueDoc.GetDescription<DBValue>();
foreach (var itemInfo in item.detail)
{
pikTbLogsql = @"
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{7}' AND a.WorkPoint='{6}' AND Quantity-LockQuantity-'{3}'<0)
BEGIN
RAISERROR(':" + "{7}" + @"',16,1);
RETURN
END
UPDATE ICSMOApply SET MUSER='{5}' WHERE ApplyCode='{1}' and Sequence='{2}' ; ";
IF NOT EXISTS(SELECT TransCode FROM ICSWareHouseLotInfoLog WHERE TransCode='{1}' AND TransSequence='{2}' AND LotNo='{7}' AND WorkPoint='{6}' AND TransType='15')
BEGIN
INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
MTIME,WorkPoint,EATTRIBUTE1)
SELECT NEWID(),'{0}','{1}','{2}',a.LotNo ,a.InvCode ,
a.WarehouseCode,a.LocationCode,'','','{3}',
'','1','15','{4}','0','',
'','','','{5}' ,(select Top 1 f.F_RealName FROM ICSInventoryLot a INNER JOIN Sys_SRM_User f ON f.F_Account='{5}' AND a.WorkPoint=f.F_Location) ,
SYSDATETIME() ,'{6}' ,''
FROM ICSWareHouseLotInfo a
WHERE a.LotNo='{7}' AND a.WorkPoint='{6}'
update ICSWareHouseLotInfo set LockQuantity=LockQuantity+'{3}' where LotNo='{7}' AND WorkPoint='{6}'
END ";
pikTbLogsql = string.Format(pikTbLogsql, Identification, item.TransCode, item.TransSequence, itemInfo.CurrentQuantity
, BusinessCode, item.User, item.WorkPoint, itemInfo.LotNo);
log.Debug("1");
@ -17441,14 +17511,14 @@ a.ExtensionID
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static DataTable BackPickMerge(List<LOTStockModel> JsonData)
public static DataTable BackPickMerge(WMSSourceDocumentModel JsonData)
{
String PrintEnable = "";
var language = LanguageHelper.GetName("WMSAPIInfo");
if (JsonData.Count <= 0)
{
throw new Exception(language.GetNameByCode("WMSAPIInfo007"));//"传送数据为空!"
}
//if (JsonData.Count <= 0)
//{
// throw new Exception(language.GetNameByCode("WMSAPIInfo007"));//"传送数据为空!"
//}
List<LOTStockModelList> model = new List<LOTStockModelList>();
DataTable printTable = new DataTable();
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
@ -17465,88 +17535,38 @@ a.ExtensionID
string TransType = string.Empty;
string pikTbLogsql = "";
string Identification = Guid.NewGuid().ToString();
foreach (var item in JsonData)
{
TransType = item.TransType;
if (!EnumHelper.HasDescriptions(typeof(TransTypeEnum), TransType))
//foreach (var item in JsonData)
//{
//TransType = item.TransType;
if (!EnumHelper.HasDescriptions(typeof(TransTypeEnum), JsonData.TransType))
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
}
else if (string.IsNullOrEmpty(item.TransCode))
else if (string.IsNullOrEmpty(JsonData.TransCode))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo001"));//"单据号不能为空!"
}
string[] trans = item.TransCode.Split('~');
string MergeID = "";
if (trans.Length == 2)
{
MergeID = trans[0];
item.TransCode = trans[1];
}
//string[] trans = item.TransCode.Split('~');
//string MergeID = "";
//if (trans.Length == 2)
//{
// MergeID = trans[0];
// item.TransCode = trans[1];
//}
#region 销售出库
else if (TransType == TransTypeEnum.SalesShipmentDoc.GetDescription())
else if (JsonData.TransType == TransTypeEnum.SalesShipmentDoc.GetDescription()
|| JsonData.TransType == TransTypeEnum.MOIssueDoc.GetDescription()
|| JsonData.TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
{
BusinessCode = TransTypeEnum.SalesShipmentDoc.GetDescription<DBValue>();
//更新源头单据数量
pikTbLogsql += string.Format(@" IF EXISTS(SELECT * FROM ICSSDN b
where b.SDNCode = '{0}' AND b.workpoint='{1}' and b.SDNQuantity>0)
BEGIN
RAISERROR('{0}!',16,1);
RETURN
END
delete ICSMOPickMerge from ICSMOPickMerge a
LEFT JOIN ICSSDN b on a.SourceID=b.id and a.WorkPoint=b.WorkPoint
where b.SDNCode = '{0}' AND b.workpoint='{1}'", item.TransCode, item.WorkPoint);
if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
{
throw new Exception("回撤拣料失败!");
}
}
#endregion
#region 生产发料
else if (TransType == TransTypeEnum.MOIssueDoc.GetDescription())
{
BusinessCode = TransTypeEnum.MOIssueDoc.GetDescription<DBValue>();
//更新源头单据数量
pikTbLogsql += string.Format(@"IF EXISTS(SELECT * FROM ICSMO b
INNER join ICSMOPick c on c.MODetailID=b.MODetailID and c.WorkPoint=b.WorkPoint
where b.MOCode = '{0}' AND b.workpoint='{1}' and c.IssueQuantity>0)
BEGIN
RAISERROR('{0}!',16,1);
RETURN
END
delete ICSMOPickMerge from ICSMOPickMerge a
INNER join ICSMOPick c on a.SourceID=c.id and a.WorkPoint=c.WorkPoint
LEFT JOIN ICSMO b on c.MODetailID=b.MODetailID and c.WorkPoint=b.WorkPoint and b.MOStatus<>'3'
where b.MOCode = '{0}' AND b.workpoint='{1}'", item.TransCode, item.WorkPoint);
if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
{
throw new Exception("回撤拣料失败!");
}
}
#endregion
#region 委外发料
else if ( TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
{
BusinessCode = TransTypeEnum.OutsourcingIssueDoc.GetDescription<DBValue>();
//更新源头单据数量
pikTbLogsql += string.Format(@" IF EXISTS(SELECT * FROM ICSOutsourcingOrder b
INNER join ICSOOPick c on c.OODetailID=b.OODetailID and c.WorkPoint=b.WorkPoint
where b.OOCode = '{0}' AND b.workpoint='{1}' and c.IssueQuantity>0)
BEGIN
RAISERROR('{0}!',16,1);
RETURN
END
delete ICSMOPickMerge from ICSMOPickMerge a
INNER join ICSOOPick c on a.SourceID=c.id and a.WorkPoint=c.WorkPoint
LEFT JOIN ICSOutsourcingOrder b on c.OODetailID=b.OODetailID and c.WorkPoint=b.WorkPoint
where b.OOCode = '{0}' AND b.workpoint='{1}'", item.TransCode, item.WorkPoint);
pikTbLogsql += string.Format(@" update b set b.LockQuantity=convert(decimal(18,6),b.LockQuantity)-convert(decimal(18,6),c.Quantity )
from dbo.ICSWareHouseLotInfo b
inner join (select sum(Quantity) as Quantity, LotNo from ICSWareHouseLotInfolog where TransCode ='{0}' and TransType='15' and WorkPoint='{1}' group by LotNo) c
on c.LotNo =b.LotNo ", JsonData.TransCode, JsonData.WorkPoint);
pikTbLogsql += string.Format(@" delete dbo.ICSWareHouseLotInfoLog where TransCode ='{0}' and TransType='15' and WorkPoint='{1}'", JsonData.TransCode, JsonData.WorkPoint);
if (!DBHelper.ExecuteNonQuery(pikTbLogsql, cmd))
{
throw new Exception("回撤拣料失败!");
@ -17557,7 +17577,7 @@ a.ExtensionID
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
}
}
//}
DataTable table = null;
cmd.Transaction.Commit();
return table;

4
ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

@ -1042,8 +1042,8 @@ namespace ICSSoft.WebAPI.Controllers
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
List<LOTStockModel> model = new List<LOTStockModel>();
model = JsonConvert.DeserializeObject<List<LOTStockModel>>(JsonData.ToString());
WMSSourceDocumentModel model = new WMSSourceDocumentModel();
model = JsonConvert.DeserializeObject<WMSSourceDocumentModel>(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.LOTStockDownCreate(model);
var resultStr = ICSSubmitService.BackPickMerge(model);

Loading…
Cancel
Save