diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj b/ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj
index e47675b..e709ded 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.Common/ICSSoft.Common.csproj
@@ -67,6 +67,7 @@
+
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.Common/SystemHelper.cs b/ICSSoft.WMS.WebAPI/ICSSoft.Common/SystemHelper.cs
new file mode 100644
index 0000000..67c633f
--- /dev/null
+++ b/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
+
+ }
+
+
+
+}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
index e8d352a..2dd2c36 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
+++ b/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 NewBarCodeList = new List();
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)