Browse Source

合并发料

master
lixh 3 years ago
parent
commit
5dd833e2b7
  1. 22
      ICSSoft.WMS.WebAPI/ICSSoft.Common/TransTypeEnum.cs
  2. 240
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  3. 20
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

22
ICSSoft.WMS.WebAPI/ICSSoft.Common/TransTypeEnum.cs

@ -30,15 +30,15 @@ namespace ICSSoft.Common
[Description("委外发料-委外订单备料表")] [Description("委外发料-委外订单备料表")]
[DBValue("5")] [DBValue("5")]
OutsourcingIssueDoc,
OutsourcingIssueDoc, //(合并发料)
[Description("委外发料-委外领料申请单")] [Description("委外发料-委外领料申请单")]
[DBValue("6")] [DBValue("6")]
OOApply,
OOApply, //(合并发料)
[Description("委外发料-委外材料出库单")] [Description("委外发料-委外材料出库单")]
[DBValue("7")] [DBValue("7")]
OOIssue,
OOIssue, //(合并发料)
[Description("委外退料-委外退料单")] [Description("委外退料-委外退料单")]
[DBValue("8")] [DBValue("8")]
@ -74,15 +74,15 @@ namespace ICSSoft.Common
[Description("生产发料-生产订单备料表")] [Description("生产发料-生产订单备料表")]
[DBValue("13")] [DBValue("13")]
MOIssueDoc,
MOIssueDoc, //(合并发料)
[Description("生产发料-领料申请单")] [Description("生产发料-领料申请单")]
[DBValue("14")] [DBValue("14")]
MOApply,
MOApply, //(合并发料)
[Description("生产发料-材料出库单")] [Description("生产发料-材料出库单")]
[DBValue("15")] [DBValue("15")]
MOIssue,
MOIssue, //(合并发料)
[Description("生产退料-生产退料单")] [Description("生产退料-生产退料单")]
[DBValue("16")] [DBValue("16")]
@ -106,7 +106,7 @@ namespace ICSSoft.Common
[Description("销售发货-销售发货单")] [Description("销售发货-销售发货单")]
[DBValue("19")] [DBValue("19")]
SalesShipmentDoc,
SalesShipmentDoc, //(合并发料)
[Description("销售退货-销售退货单")] [Description("销售退货-销售退货单")]
[DBValue("20")] [DBValue("20")]
@ -114,11 +114,11 @@ namespace ICSSoft.Common
[Description("一步调拨")] [Description("一步调拨")]
[DBValue("21")] [DBValue("21")]
OneStepTransferDocIn,
OneStepTransferDocIn, //(合并发料)
[Description("两步调出")] [Description("两步调出")]
[DBValue("22")] [DBValue("22")]
TwoStepTransferDocOut,
TwoStepTransferDocOut, //(合并发料)
[Description("两步调入")] [Description("两步调入")]
[DBValue("23")] [DBValue("23")]
@ -130,7 +130,7 @@ namespace ICSSoft.Common
[Description("杂发")] [Description("杂发")]
[DBValue("24")] [DBValue("24")]
OtherOutDoc,
OtherOutDoc, //(合并发料)
[Description("杂收")] [Description("杂收")]
[DBValue("25")] [DBValue("25")]
@ -138,7 +138,7 @@ namespace ICSSoft.Common
[Description("借用")] [Description("借用")]
[DBValue("26")] [DBValue("26")]
BrrowDoc,
BrrowDoc, //(合并发料)
[Description("归还")] [Description("归还")]
[DBValue("27")] [DBValue("27")]

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

@ -57,13 +57,13 @@ namespace ICSSoft.DataProject
string TransType = JsonData.TransType; string TransType = JsonData.TransType;
#region SLQ #region SLQ
string sql = @"IF NOT EXISTS(SELECT a.ID FROM {1} WHERE {2})
string sqlCheck = @"IF NOT EXISTS(SELECT a.ID FROM {1} WHERE {2})
BEGIN BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo035") + @"',16,1); RAISERROR('" + language.GetNameByCode("WMSAPIInfo035") + @"',16,1);
RETURN RETURN
END END
SELECT a.ID,
";
string sql = @"SELECT a.ID,
{0} {0}
a.InvCode, a.InvCode,
inv.InvName, inv.InvName,
@ -103,6 +103,9 @@ namespace ICSSoft.DataProject
string columns = string.Empty; //查询源头单据表的特殊列名 string columns = string.Empty; //查询源头单据表的特殊列名
string tableName = string.Empty; //查询源头单据表名 string tableName = string.Empty; //查询源头单据表名
string where = string.Empty; //查询源头单据的过滤条件 string where = string.Empty; //查询源头单据的过滤条件
bool isMerge = false; //合并发料
string columnsMerge = string.Empty; //合并发料查询源头单据表的特殊列名
string tableNameMerge = string.Empty; //合并发料查询源头单据表名
#region 出库 #region 出库
#region 采购退货 #region 采购退货
if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription()) if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription())
@ -123,9 +126,20 @@ namespace ICSSoft.DataProject
where = @" a.DNCode='{0}' AND a.WorkPoint='{1}' AND a.DNType='2' "; where = @" a.DNCode='{0}' AND a.WorkPoint='{1}' AND a.DNType='2' ";
} }
#endregion #endregion
#region 委外发料
#region 委外发料(合并发料)
else if (TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription()) else if (TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+b.OOCode AS TransCode,
a.PickID AS DetailID,
a.SupplyType AS Type,
b.Sequence+'-'+a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSOOPick a
INNER JOIN ICSOutsourcingOrder b ON a.OODetailID=b.OODetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOPickMerge mer ON a.PickID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"b.OOCode AS TransCode, columns = @"b.OOCode AS TransCode,
a.PickID AS DetailID, a.PickID AS DetailID,
a.SupplyType AS Type, a.SupplyType AS Type,
@ -157,9 +171,20 @@ namespace ICSSoft.DataProject
where = @" a.ODNCode='{0}' AND a.WorkPoint='{1}' AND a.ODNType='2' "; where = @" a.ODNCode='{0}' AND a.WorkPoint='{1}' AND a.ODNType='2' ";
} }
#endregion #endregion
#region 生产发料
#region 生产发料(合并发料)
else if (TransType == TransTypeEnum.MOIssueDoc.GetDescription()) else if (TransType == TransTypeEnum.MOIssueDoc.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+b.MOCode AS TransCode,
a.PickID AS DetailID,
a.SupplyType AS Type,
b.Sequence+'-'+a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSMOPick a
INNER JOIN ICSMO b ON a.MODetailID=b.MODetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSMOPickMerge mer ON a.PickID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"b.MOCode AS TransCode, columns = @"b.MOCode AS TransCode,
a.PickID AS DetailID, a.PickID AS DetailID,
a.SupplyType AS Type, a.SupplyType AS Type,
@ -172,9 +197,19 @@ namespace ICSSoft.DataProject
where = @" b.MOCode='{0}' AND a.WorkPoint='{1}' "; where = @" b.MOCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 销售出库
#region 销售出库(合并发料)
else if (TransType == TransTypeEnum.SalesShipmentDoc.GetDescription()) else if (TransType == TransTypeEnum.SalesShipmentDoc.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.SDNCode AS TransCode,
a.SDNDetailID AS DetailID,
a.Type,
a.Sequence AS TransSequence,
a.SDNQuantity AS IssueQuantity,";
tableNameMerge = @"ICSSDN a
INNER JOIN ICSMOPickMerge mer ON a.SDNDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.SDNCode AS TransCode, columns = @"a.SDNCode AS TransCode,
a.SDNDetailID AS DetailID, a.SDNDetailID AS DetailID,
a.Type, a.Type,
@ -190,13 +225,7 @@ namespace ICSSoft.DataProject
else if (TransType == TransTypeEnum.Check.GetDescription()) else if (TransType == TransTypeEnum.Check.GetDescription())
{ {
#region SLQ #region SLQ
sql = @"IF NOT EXISTS(SELECT a.ID FROM {1} WHERE {2})
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo035") + @"',16,1);
RETURN
END
SELECT a.ID,
sql = @"SELECT a.ID,
{0} {0}
a.InvCode, a.InvCode,
inv.InvName, inv.InvName,
@ -226,18 +255,22 @@ namespace ICSSoft.DataProject
where = @" a.CheckCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.CheckCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 一步调拨
#region 一步调拨(合并发料)
else if (TransType == TransTypeEnum.OneStepTransferDocIn.GetDescription()) else if (TransType == TransTypeEnum.OneStepTransferDocIn.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.TransferNO AS TransCode,
a.TransferDetailID AS DetailID,
'' AS Type,
a.Sequence AS TransSequence,
a.TransferQuantity AS IssueQuantity,
a.ToWarehouseCode,";
#region SLQ
sql = @"IF NOT EXISTS(SELECT a.ID FROM {1} WHERE {2})
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo035") + @"',16,1);
RETURN
END
tableNameMerge = @"ICSTransfer a
INNER JOIN ICSMOPickMerge mer ON a.TransferDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
SELECT a.ID,
#region SLQ
sql = @"SELECT a.ID,
{0} {0}
a.InvCode, a.InvCode,
inv.InvName, inv.InvName,
@ -285,9 +318,20 @@ namespace ICSSoft.DataProject
where = @" a.TransferNO='{0}' AND a.WorkPoint='{1}' AND a.Status='1' "; where = @" a.TransferNO='{0}' AND a.WorkPoint='{1}' AND a.Status='1' ";
} }
#endregion #endregion
#region 两步调出
#region 两步调出(合并发料)
else if (TransType == TransTypeEnum.TwoStepTransferDocOut.GetDescription()) else if (TransType == TransTypeEnum.TwoStepTransferDocOut.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.OutCode AS TransCode,
a.OutDetailID AS DetailID,
'' AS Type,
a.Sequence AS TransSequence,
a.OutQuantity AS IssueQuantity,";
tableNameMerge = @"ICSOtherOut a
INNER JOIN ICSTransfer tra ON a.TransferDetailID=tra.TransferDetailID AND a.WorkPoint=tra.WorkPoint
INNER JOIN ICSMOPickMerge mer ON a.OutDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.OutCode AS TransCode, columns = @"a.OutCode AS TransCode,
a.OutDetailID AS DetailID, a.OutDetailID AS DetailID,
'' AS Type, '' AS Type,
@ -300,9 +344,19 @@ namespace ICSSoft.DataProject
where = @" a.OutCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.OutCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 其他出库
#region 其他出库(合并发料)
else if (TransType == TransTypeEnum.OtherOutDoc.GetDescription()) else if (TransType == TransTypeEnum.OtherOutDoc.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.OutCode AS TransCode,
a.OutDetailID AS DetailID,
'' AS Type,
a.Sequence AS TransSequence,
a.OutQuantity AS IssueQuantity,";
tableNameMerge = @"ICSOtherOut a
INNER JOIN ICSMOPickMerge mer ON a.OutDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.OutCode AS TransCode, columns = @"a.OutCode AS TransCode,
a.OutDetailID AS DetailID, a.OutDetailID AS DetailID,
'' AS Type, '' AS Type,
@ -314,9 +368,19 @@ namespace ICSSoft.DataProject
where = @" a.OutCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.OutCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 领料申请单发料
#region 领料申请单发料(合并发料)
else if (TransType == TransTypeEnum.MOApply.GetDescription()) else if (TransType == TransTypeEnum.MOApply.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.ApplyCode AS TransCode,
a.ApplyDetailID AS DetailID,
a.Type,
a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSMOApply a
INNER JOIN ICSMOPickMerge mer ON a.ApplyDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.ApplyCode AS TransCode, columns = @"a.ApplyCode AS TransCode,
a.ApplyDetailID AS DetailID, a.ApplyDetailID AS DetailID,
a.Type, a.Type,
@ -328,9 +392,19 @@ namespace ICSSoft.DataProject
where = @" a.ApplyCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.ApplyCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 委外领料申请单发料
#region 委外领料申请单发料(合并发料)
else if (TransType == TransTypeEnum.OOApply.GetDescription()) else if (TransType == TransTypeEnum.OOApply.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.ApplyCode AS TransCode,
a.ApplyDetailID AS DetailID,
a.Type,
a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSOApply a
INNER JOIN ICSMOPickMerge mer ON a.ApplyDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.ApplyCode AS TransCode, columns = @"a.ApplyCode AS TransCode,
a.ApplyDetailID AS DetailID, a.ApplyDetailID AS DetailID,
a.Type, a.Type,
@ -342,9 +416,19 @@ namespace ICSSoft.DataProject
where = @" a.ApplyCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.ApplyCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 开立材料出库
#region 开立材料出库(合并发料)
else if (TransType == TransTypeEnum.MOIssue.GetDescription()) else if (TransType == TransTypeEnum.MOIssue.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.IssueCode AS TransCode,
a.IssueDetailID AS DetailID,
a.Type,
a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSMOIssue a
INNER JOIN ICSMOPickMerge mer ON a.IssueDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.IssueCode AS TransCode, columns = @"a.IssueCode AS TransCode,
a.IssueDetailID AS DetailID, a.IssueDetailID AS DetailID,
a.Type, a.Type,
@ -356,9 +440,19 @@ namespace ICSSoft.DataProject
where = @" a.IssueCode='{0}' AND a.WorkPoint='{1}' "; where = @" a.IssueCode='{0}' AND a.WorkPoint='{1}' ";
} }
#endregion #endregion
#region 开立委外材料出库
#region 开立委外材料出库(合并发料)
else if (TransType == TransTypeEnum.OOIssue.GetDescription()) else if (TransType == TransTypeEnum.OOIssue.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.IssueCode AS TransCode,
a.IssueDetailID AS DetailID,
a.Type,
a.Sequence AS TransSequence,
a.IssueQuantity AS IssueQuantity,";
tableNameMerge = @"ICSOIssue a
INNER JOIN ICSMOPickMerge mer ON a.IssueDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.IssueCode AS TransCode, columns = @"a.IssueCode AS TransCode,
a.IssueDetailID AS DetailID, a.IssueDetailID AS DetailID,
a.Type, a.Type,
@ -398,9 +492,19 @@ namespace ICSSoft.DataProject
where = @" a.RCVCode='{0}' AND a.WorkPoint='{1}' AND a.Type='2' "; where = @" a.RCVCode='{0}' AND a.WorkPoint='{1}' AND a.Type='2' ";
} }
#endregion #endregion
#region 借用
#region 借用(合并发料)
else if (TransType == TransTypeEnum.BrrowDoc.GetDescription()) else if (TransType == TransTypeEnum.BrrowDoc.GetDescription())
{ {
isMerge = true;
columnsMerge = @"mer.MergeID+'-'+a.BrrowCode AS TransCode,
a.BrrowDetailID AS DetailID,
'' AS Type,
a.Sequence AS TransSequence,
a.BrrowQuantity AS IssueQuantity,";
tableNameMerge = @"ICSBrrow a
INNER JOIN ICSMOPickMerge mer ON a.BrrowDetailID=mer.SourceID AND a.WorkPoint=mer.WorkPoint";
columns = @"a.BrrowCode AS TransCode, columns = @"a.BrrowCode AS TransCode,
a.BrrowDetailID AS DetailID, a.BrrowDetailID AS DetailID,
'' AS Type, '' AS Type,
@ -571,16 +675,10 @@ namespace ICSSoft.DataProject
#endregion #endregion
if (string.IsNullOrWhiteSpace(columns) || string.IsNullOrWhiteSpace(tableName) || string.IsNullOrWhiteSpace(where)) if (string.IsNullOrWhiteSpace(columns) || string.IsNullOrWhiteSpace(tableName) || string.IsNullOrWhiteSpace(where))
throw new Exception(language.GetNameByCode("WMSAPIInfo003")); throw new Exception(language.GetNameByCode("WMSAPIInfo003"));
if (isDeliveryNotice)
if (isDeliveryNotice)//送货、到货、含委外
{ {
#region SLQ #region SLQ
sql = @"IF NOT EXISTS(SELECT a.ID FROM {1} WHERE {2})
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo035") + @"',16,1);
RETURN
END
SELECT a.ID,
sql = sqlCheck + @"SELECT a.ID,
{0} {0}
a.InvCode, a.InvCode,
inv.InvName, inv.InvName,
@ -609,7 +707,26 @@ namespace ICSSoft.DataProject
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE {2} "; WHERE {2} ";
#endregion #endregion
}
else if(isMerge)//合并发料
{
#region SLQ
string sqlMerge = @"IF EXISTS(SELECT ID FROM ICSMOPickMerge WHERE MergeID='{3}' AND WorkPoint='{4}' )
BEGIN
"+ sql;
string whereMerge = string.Format("mer.MergeID='{0}' AND mer.WorkPoint='{1}'", JsonData.TransCode, JsonData.WorkPoint);
sqlMerge = string.Format(sqlMerge, columnsMerge, tableNameMerge, whereMerge, JsonData.TransCode, JsonData.WorkPoint);
sql = sqlMerge + @"
END
ELSE
BEGIN
" + sqlCheck + sql + @"
END";
#endregion
}
else
{
sql = sqlCheck + sql;
} }
where = string.Format(where, JsonData.TransCode, JsonData.WorkPoint); where = string.Format(where, JsonData.TransCode, JsonData.WorkPoint);
sql = string.Format(sql, columns, tableName, where, JsonData.TransCode); sql = string.Format(sql, columns, tableName, where, JsonData.TransCode);
@ -722,6 +839,7 @@ namespace ICSSoft.DataProject
|| TransType == TransTypeEnum.OutsourcingReceiveDocNegative.GetDescription()//开立委外红字入库单 || TransType == TransTypeEnum.OutsourcingReceiveDocNegative.GetDescription()//开立委外红字入库单
|| TransType == TransTypeEnum.BrrowDoc.GetDescription() //借用 || TransType == TransTypeEnum.BrrowDoc.GetDescription() //借用
|| TransType == TransTypeEnum.TransferLibrary.GetDescription() //移库 || TransType == TransTypeEnum.TransferLibrary.GetDescription() //移库
//|| TransType == TransTypeEnum.DisassemblyDoc.GetDescription() //拆卸单(散件生成条码入库)
) )
{ {
isOut = true; isOut = true;
@ -1314,6 +1432,10 @@ namespace ICSSoft.DataProject
BusinessCode = TransTypeEnum.SalesReturnBack.GetDescription<DBValue>(); BusinessCode = TransTypeEnum.SalesReturnBack.GetDescription<DBValue>();
} }
#endregion #endregion
else
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
}
//入库 //入库
ICSWareHouseLotInfoService.WareHouseLotInfoUp(Identification, itemInfo.LocationCode, itemInfo.LotNo, itemInfo.Quantity, ICSWareHouseLotInfoService.WareHouseLotInfoUp(Identification, itemInfo.LocationCode, itemInfo.LotNo, itemInfo.Quantity,
item.User, item.WorkPoint, WHTransType, BusinessCode, cmd, language,itemInfo.LogID); item.User, item.WorkPoint, WHTransType, BusinessCode, cmd, language,itemInfo.LogID);
@ -1436,6 +1558,13 @@ namespace ICSSoft.DataProject
{ {
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!" throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
} }
string[] trans = item.TransCode.Split('-');
string MergeID = "";
if (trans.Length == 2)
{
MergeID = trans[0];
item.TransCode = trans[1];
}
#region 采购退货 #region 采购退货
if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription()) if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription())
{ {
@ -1460,7 +1589,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OutsourcingIssueDoc.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.OutsourcingIssueDoc.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1488,7 +1617,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssueDoc.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssueDoc.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1502,7 +1631,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.SalesShipmentDoc.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.SalesShipmentDoc.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1516,7 +1645,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "6", TransTypeEnum.TwoStepTransferDocOut.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "6", TransTypeEnum.TwoStepTransferDocOut.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1530,7 +1659,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OtherOutDoc.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.OtherOutDoc.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1544,7 +1673,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.MOApply.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.MOApply.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1558,7 +1687,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OOApply.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.OOApply.GetDescription<DBValue>(), cmd, language,MergeID);
} }
} }
#endregion #endregion
@ -1572,7 +1701,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssue.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssue.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1586,7 +1715,7 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OOIssue.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.OOIssue.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
@ -1628,10 +1757,14 @@ namespace ICSSoft.DataProject
{ {
//出库 //出库
ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity, ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.BrrowDoc.GetDescription<DBValue>(), cmd, language);
item.User, item.WorkPoint, "3", TransTypeEnum.BrrowDoc.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
#endregion #endregion
else
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
}
} }
//上传ERP //上传ERP
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
@ -3431,6 +3564,13 @@ namespace ICSSoft.DataProject
throw new Exception(language.GetNameByCode("WMSAPIInfo027"));//"调拨单号不能为空!"); throw new Exception(language.GetNameByCode("WMSAPIInfo027"));//"调拨单号不能为空!");
} }
string[] trans = item.TransCode.Split('-');
string MergeID = "";
if (trans.Length == 2)
{
MergeID = trans[0];
item.TransCode = trans[1];
}
//验证信息 //验证信息
sql = @"DECLARE @Status VARCHAR(10) sql = @"DECLARE @Status VARCHAR(10)
SELECT @Status=Status FROM ICSTransfer WHERE TransferNO='{0}' and WorkPoint='{1}' AND Type = '1' SELECT @Status=Status FROM ICSTransfer WHERE TransferNO='{0}' and WorkPoint='{1}' AND Type = '1'
@ -3477,7 +3617,7 @@ namespace ICSSoft.DataProject
//更新条码信息 //更新条码信息
ICSWareHouseLotInfoService.WareHouseLotInfoTransfer(Identification, item.TransCode, item.TransSequence, itemInfo.WarehouseCode, itemInfo.LocationCode, ICSWareHouseLotInfoService.WareHouseLotInfoTransfer(Identification, item.TransCode, item.TransSequence, itemInfo.WarehouseCode, itemInfo.LocationCode,
itemInfo.LotNo, itemInfo.CurrentQuantity, item.User, item.WorkPoint, "6", "21", cmd, language);
itemInfo.LotNo, itemInfo.CurrentQuantity, item.User, item.WorkPoint, "6", TransTypeEnum.OneStepTransferDocIn.GetDescription<DBValue>(), cmd, language, MergeID);
} }
} }
ICSWareHouseService.OneStepTransferDocInERP(TransTypeEnum.OneStepTransferDocIn.GetDescription(), Identification, cmd, language); ICSWareHouseService.OneStepTransferDocInERP(TransTypeEnum.OneStepTransferDocIn.GetDescription(), Identification, cmd, language);
@ -4051,8 +4191,8 @@ namespace ICSSoft.DataProject
} }
sql = @"SELECT a.ContainerCode, a.ContainerName,b.LotNo FROM ICSContainer a sql = @"SELECT a.ContainerCode, a.ContainerName,b.LotNo FROM ICSContainer a
INNER JOIN ICSContainerLot b ON a.ID=b.ContainerID INNER JOIN ICSContainerLot b ON a.ID=b.ContainerID
WHERE a.ContainerCODE+a.WorkPoint='{0}'";
sql = string.Format(sql, codes);
WHERE a.ContainerCODE+a.WorkPoint IN({0})";
sql = string.Format(sql, codes.Substring(0,codes.Length - 1));
DataTable table = DBHelper.SQlReturnData(sql, cmd); DataTable table = DBHelper.SQlReturnData(sql, cmd);
cmd.Transaction.Commit(); cmd.Transaction.Commit();
return table; return table;

20
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

@ -91,12 +91,12 @@ namespace ICSSoft.DataProject
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
MTIME,WorkPoint,EATTRIBUTE1)
MTIME,WorkPoint,EATTRIBUTE1,LogID)
SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode , SELECT NEWID(),'{3}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode ,
'','',c.WarehouseCode,c.LocationCode,'{6}', '','',c.WarehouseCode,c.LocationCode,'{6}',
'','0','{4}','{5}','0','', '','0','{4}','{5}','0','',
'','','',f.F_Account ,f.F_RealName , '','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,'{7}'
SYSDATETIME() ,a.WorkPoint ,'','{7}'
FROM ICSInventoryLot a FROM ICSInventoryLot a
INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
@ -130,7 +130,7 @@ namespace ICSSoft.DataProject
/// <param name="BusinessCode"></param> /// <param name="BusinessCode"></param>
/// <param name="cmd"></param> /// <param name="cmd"></param>
public static void WareHouseLotInfoDown(string Identification, string TransCode, string TransSequence, string LotNo, string Quantity, string User, public static void WareHouseLotInfoDown(string Identification, string TransCode, string TransSequence, string LotNo, string Quantity, string User,
string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language)
string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language,string MergeID="")
{ {
try try
{ {
@ -159,18 +159,18 @@ namespace ICSSoft.DataProject
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
MTIME,WorkPoint,EATTRIBUTE1)
MTIME,WorkPoint,EATTRIBUTE1,MergeID)
SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode , SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode ,
c.WarehouseCode,c.LocationCode,'','','{6}', c.WarehouseCode,c.LocationCode,'','','{6}',
'','0','{7}','{8}','0','', '','0','{7}','{8}','0','',
'','','',f.F_Account ,f.F_RealName , '','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,''
SYSDATETIME() ,a.WorkPoint ,'','{9}'
FROM ICSInventoryLot a FROM ICSInventoryLot a
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
"; ";
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode);
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, MergeID);
if (!DBHelper.ExecuteNonQuery(sql, cmd)) if (!DBHelper.ExecuteNonQuery(sql, cmd))
{ {
@ -274,7 +274,7 @@ namespace ICSSoft.DataProject
/// <param name="BusinessCode"></param> /// <param name="BusinessCode"></param>
/// <param name="cmd"></param> /// <param name="cmd"></param>
public static void WareHouseLotInfoTransfer(string Identification, string TransCode, string TransSequence, string WarehouseCode, string LocationCode, public static void WareHouseLotInfoTransfer(string Identification, string TransCode, string TransSequence, string WarehouseCode, string LocationCode,
string LotNo, string Quantity, string User, string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language)
string LotNo, string Quantity, string User, string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language, string MergeID)
{ {
try try
{ {
@ -289,18 +289,18 @@ namespace ICSSoft.DataProject
FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity, FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID, Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName, ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
MTIME,WorkPoint,EATTRIBUTE1)
MTIME,WorkPoint,EATTRIBUTE1,MergeID)
SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode , SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode ,
c.WarehouseCode,c.LocationCode,'{9}','{10}','{6}', c.WarehouseCode,c.LocationCode,'{9}','{10}','{6}',
'','0','{7}','{8}','0','', '','0','{7}','{8}','0','',
'','','',f.F_Account ,f.F_RealName , '','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,''
SYSDATETIME() ,a.WorkPoint ,'','{11}'
FROM ICSInventoryLot a FROM ICSInventoryLot a
INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
"; ";
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, WarehouseCode, LocationCode);
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, WarehouseCode, LocationCode, MergeID);
if (!DBHelper.ExecuteNonQuery(sql, cmd)) if (!DBHelper.ExecuteNonQuery(sql, cmd))
{ {

Loading…
Cancel
Save