Browse Source

先进先出,单据/条码返回ExtensionID

master
lixh 3 years ago
parent
commit
c66fac1881
  1. 85
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  2. 7
      ICSSoft.WMS.WebAPI/ICSSoft.Entity/BarCodeModel.cs
  3. 4
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

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

@ -75,6 +75,7 @@ namespace ICSSoft.DataProject
inv.AmountUnit,
wh.WarehouseName AS WHName,
ISNULL(ext.ProjectCode, '') AS ProjectCode,
a.ExtensionID,
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode,
ISNULL(ext.Version, '') AS Version,
ISNULL(ext.Brand, '') AS Brand,
@ -247,6 +248,7 @@ namespace ICSSoft.DataProject
a.FromWarehouseCode AS WHCode,
inv.AmountUnit,
wh.WarehouseName AS WHName,
a.ExtensionID,
ext.ProjectCode,
CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,
ext.Version,
@ -587,6 +589,7 @@ namespace ICSSoft.DataProject
'' AS WHCode,
inv.AmountUnit,
'' AS WHName,
a.ExtensionID,
ext.ProjectCode,
CASE WHEN ISNULL(inv.BatchEnable, '0')='1' THEN ext.BatchCode ELSE '' END AS BatchCode,
ext.Version,
@ -677,6 +680,7 @@ namespace ICSSoft.DataProject
inv.InvUnit,
{0}
inv.AmountUnit,
ext.ID AS ExtensionID,
ext.ProjectCode,
ext.Version,
ext.Brand,
@ -949,8 +953,23 @@ namespace ICSSoft.DataProject
CheckTrans(dataView, rowFilter, string.Format(language.GetNameByCode("WMSAPIInfo055"), Lot, drLot["cFree9"]));
rowFilter += " AND cFree10='" + drLot["cFree10"] + "'";
CheckTrans(dataView, rowFilter, string.Format(language.GetNameByCode("WMSAPIInfo056"), Lot, drLot["cFree10"]));
//保质期管理
var resultEffective = Effective(Lot, JsonData.WorkPoint, cmd, language);
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
if(resultEffective == "2")
{
msg += string.Format(language.GetNameByCode("WMSAPIInfo181"), Lot)+Environment.NewLine;
}
else if (resultEffective == "3")
{
msg += string.Format(language.GetNameByCode("WMSAPIInfo182"), Lot) + Environment.NewLine;
isLimit = true;
}
//先进先出判断
var result = CanOut(Lot, JsonData.WorkPoint, cmd);
var result = CanOut(Lot, JsonData.WorkPoint, JsonData.ScanLotCode, cmd, language);
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
@ -3595,7 +3614,7 @@ namespace ICSSoft.DataProject
/// <param name="WorkPoitCode"></param>
/// <param name="cmd"></param>
/// <returns></returns>
public static string CanOut(string LotNo, string WorkPoitCode, SqlCommand cmd)
public static string CanOut(string LotNo, string WorkPoitCode, string ScanLotCode, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
@ -3606,7 +3625,7 @@ namespace ICSSoft.DataProject
SET @CountNO=(
SELECT COUNT(a.LotNO) FROM ICSWareHouseLotInfo a
INNER JOIN ICSInventoryLot b ON a.LotNO=b.LotNO AND a.WorkPoint=b.WorkPoint
WHERE a.WorkPoint='{1}' AND ISNULL(a.Quantity,0)>0
WHERE a.WorkPoint='{1}' AND ISNULL(a.Quantity,0)>0 AND 1=1
AND CONVERT(varchar(100), a.InDate, 23)<
(SELECT DATEADD(DAY, -@Days, CONVERT(varchar(100), x.InDate, 23)) FROM ICSWareHouseLotInfo x
INNER JOIN ICSInventoryLot y ON x.LotNO=y.LotNO AND x.WorkPoint=y.WorkPoint
@ -3614,7 +3633,7 @@ namespace ICSSoft.DataProject
)
IF @CountNO>0
BEGIN
SELECT TOP 1 CASE a.F_ItemCode WHEN '0000501' THEN '1' WHEN '0000502' THEN '2' ELSE '3' END AS Type
SELECT TOP 1 CASE a.F_ItemCode WHEN 'FIFO01' THEN '1' WHEN 'FIFO02' THEN '2' ELSE '3' END AS Type
FROM Sys_SRM_ItemsDetail a
INNER JOIN Sys_SRM_Items b ON a.F_ItemId=b.F_Id
WHERE b.F_EnCode='FIFO' AND a.F_EnabledMark='1'
@ -3629,10 +3648,62 @@ namespace ICSSoft.DataProject
//2 - 提醒
//3 - 限制
sql = string.Format(sql, LotNo, WorkPoitCode);
if(!string.IsNullOrWhiteSpace(ScanLotCode))
{
sql = sql.Replace("1=1", "a.LotNO NOT IN (" + ScanLotCode + ")");
}
var res = DBHelper.ExecuteScalar(sql, cmd).ToString();
if (string.IsNullOrWhiteSpace(res))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo183"));//"查询管控信息失败!");
}
else
return res;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 保质期管控
/// </summary>
/// <param name="LotNo"></param>
/// <param name="WorkPoitCode"></param>
/// <param name="cmd"></param>
/// <returns></returns>
public static string Effective(string LotNo, string WorkPoitCode, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
//根据Sys_SRM_Items.F_Description备注列维护的提前天数,比如维护的是1,最早条码是2022.5.16,现在扫描2022.5.17的条码也能出库,扫描2022.5.18的条码不能直接出,需要校验以下逻辑
string sql = @"DECLARE @CountNO INT,@Days INT,@CurrentDays INT
SELECT @CountNO=EffectiveEnable,@Days=EffectiveDays,@CurrentDays=DATEDIFF(DAY, c.InDate, GETDATE()) FROM ICSInventory a
INNER JOIN ICSInventoryLot b ON a.InvCode=b.InvCode AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSWareHouseLotInfo c ON b.LotNO=c.LotNO AND b.WorkPoint=c.WorkPoint
WHERE b.LotNO='{0}' AND b.WorkPoint='{1}'
IF @CountNO='1' AND @CurrentDays>@Days
BEGIN
SELECT TOP 1 CASE a.F_ItemCode WHEN 'Effective01' THEN '1' WHEN 'Effective02' THEN '2' ELSE '3' END AS Type
FROM Sys_SRM_ItemsDetail a
INNER JOIN Sys_SRM_Items b ON a.F_ItemId=b.F_Id
WHERE b.F_EnCode='Effective' AND a.F_EnabledMark='1'
ORDER BY a.F_SortCode DESC
END
ELSE
BEGIN
SELECT @CountNO
END";
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
sql = string.Format(sql, LotNo, WorkPoitCode);
var res = DBHelper.ExecuteScalar(sql, cmd).ToString();
if (string.IsNullOrWhiteSpace(res))
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPI004"));//"查询管控信息失败!");
throw new Exception(language.GetNameByCode("WMSAPIInfo183"));//"查询管控信息失败!");
}
else
return res;
@ -4233,13 +4304,13 @@ namespace ICSSoft.DataProject
}
else
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPI005"));//"密码不正确,请重新输入");
throw new Exception(LanguageHelper.GetNameSingle("WMSAPI004"));//"密码不正确,请重新输入");
}
}
}
else
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPI006"));//"用户名不存在,请重新输入!");
throw new Exception(LanguageHelper.GetNameSingle("WMSAPI005"));//"用户名不存在,请重新输入!");
}
return null;
}

7
ICSSoft.WMS.WebAPI/ICSSoft.Entity/BarCodeModel.cs

@ -17,8 +17,9 @@ namespace ICSSoft.Entity
/// 源头单据
/// </summary>
public string TransCode { get; set; }
/// <summary>
/// 用于排除本次已扫描的条码(多个用'',分割,如:'001','002')
/// </summary>
public string ScanLotCode { get; set; }
}
}

4
ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

@ -6,8 +6,8 @@
<configuration>
<appSettings>
<add key="ERPDB" value="UFDATA_999_2019" />
<add key="ConnStr" value="Data Source=175.27.228.107;Database=ICSWMS_Base;Uid=sa;Pwd=aA123456;" />
<add key="ERPUrl" value="http://175.27.228.107:3004/api/" />
<add key="ConnStr" value="Data Source=192.168.1.88;Database=ICSWMS_Base;Uid=sa;Pwd=aA123456;" />
<add key="ERPUrl" value="http://192.168.1.88:3004/api/" />
<add key="UploadERP" value="true" />
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />

Loading…
Cancel
Save