Browse Source

调整调拨日期

master
lilili 9 months ago
parent
commit
aa8f0e8843
  1. 1
      ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj
  2. 28
      ICSSoft.WMS.WebAPI/ICSSoft.Common/SystemHelper.cs
  3. 27
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

1
ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj

@ -67,6 +67,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DBHelper.cs" />
<Compile Include="NewTransType.cs" />
<Compile Include="SystemHelper.cs" />
<Compile Include="TransTypeEnum.cs" />
<Compile Include="VerificationMethod.cs" />
</ItemGroup>

28
ICSSoft.WMS.WebAPI/ICSSoft.Common/SystemHelper.cs

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ICSSoft.Common
{
public static class SystemHelper
{
#region DateTime
public static string GetDateNowString(string format = "yyyy-MM-dd HH:mm:ss")
{
return DateTime.Now.GetDateString(format);
}
public static string GetDateString(this DateTime dateTime,string format = "yyyy-MM-dd HH:mm:ss")
{
return dateTime.ToString(format);
}
#endregion
}
}

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

@ -1383,6 +1383,7 @@ namespace ICSSoft.DataProject
int result = 0;
DataTable dtLotno = new DataTable();
DataTable lstDt = new DataTable();
var createDate = DateTime.Now;
List<string> NewBarCodeList = new List<string>();
try
{
@ -1405,6 +1406,22 @@ namespace ICSSoft.DataProject
{
tranferWorkpoint = workPoint.ToString();
}
//查询当前物料最早出库时间
var getDate = $@"SELECT top 1 MTIME FROM ICSWareHouseLotInfo WHERE InvCode=(SELECT
top 1 a.InvCode
FROM
ICSTransfer a
WHERE
TransferNO = '{TransCode}'
AND Sequence = '{TransSequence}'
AND WorkPoint = '{WorkPoint}'
AND Type = '{TransType}') AND Quantity>0 ORDER BY MTIME ";
var date = DBHelper.ExecuteScalar(getDate, cmd);
if (date != null)
{
createDate = Convert.ToDateTime(date).AddDays(-1);
}
#region 先删除条码的占料信息
string sql = @" update b set b.LockQuantity = convert(decimal(18, 6), b.LockQuantity) - convert(decimal(18, 6), c.Quantity)
from dbo.ICSWareHouseLotInfo b
@ -1451,7 +1468,7 @@ namespace ICSSoft.DataProject
}
///更新库存
sql = @"UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)-'{2}',--LocationCode = '{3}',
WorkPoint ='{4}' WHERE LotNo='{0}' AND WorkPoint='{1}';
WorkPoint ='{4}',MTIME='{5}',InDate='{5}' WHERE LotNo='{0}' AND WorkPoint='{1}';
UPDATE ICSInventoryLot SET WorkPoint='{4}' WHERE LotNo='{0}' AND WorkPoint='{1}';
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND Quantity<0)
@ -1460,7 +1477,7 @@ namespace ICSSoft.DataProject
RETURN
END";
sql = string.Format(sql, LotNo, WorkPoint, Quantity, LocationCode, tranferWorkpoint);
sql = string.Format(sql, LotNo, WorkPoint, Quantity, LocationCode, tranferWorkpoint, createDate.GetDateString());
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
@ -1503,11 +1520,11 @@ namespace ICSSoft.DataProject
}
#endregion
sql = @"INSERT INTO ICSWareHouseLotInfo(ID,LotNO,WarehouseCode,LocationCode,InvCode,Quantity,InDate,LockQuantity,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
select NEWID(),'{0}','{4}','{5}',InvCode,'{2}',InDate,0
,MUSER,MUSERName,GETDATE(),'{3}',''
select NEWID(),'{0}','{4}','{5}',InvCode,'{2}','{6}',0
,MUSER,MUSERName,'{6}','{3}',''
from ICSWareHouseLotInfo
where LotNO='{1}' AND WorkPoint='{3}'";
sql = string.Format(sql, lotstr, LotNo, Quantity, tranferWorkpoint, WarehouseCode, LocationCode);
sql = string.Format(sql, lotstr, LotNo, Quantity, tranferWorkpoint, WarehouseCode, LocationCode, createDate.GetDateString());
cmd.CommandText = sql;
result = cmd.ExecuteNonQuery();
if (result <= 0)

Loading…
Cancel
Save