Browse Source

no message

master
yangtm 8 months ago
parent
commit
94a1cc9df0
  1. 127
      ICSSoft.FromERP/ICSSoft.FromERP/ICSWareHouseLotInfoDoc.cs

127
ICSSoft.FromERP/ICSSoft.FromERP/ICSWareHouseLotInfoDoc.cs

@ -9,6 +9,7 @@ using ICSSoft.Frame.Data.Entity;
using ICSSoft.Base.Config.AppConfig; using ICSSoft.Base.Config.AppConfig;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using Newtonsoft.Json;
namespace ICSSoft.FromERP namespace ICSSoft.FromERP
{ {
@ -48,33 +49,37 @@ namespace ICSSoft.FromERP
try try
{ {
//获取成品入库单 //获取成品入库单
var manufactureReceives = db.ICSManufactureReceive.Where(e=>e.Status=="3"&&e.RCVQuantity==0).ToList();
var manufactureReceives = db.ICSManufactureReceive.Where(e => e.Status == "3" && e.RCVQuantity == 0).ToList();
//基础信息 //基础信息
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
string user= "JOB";
string user = "JOB";
string username = "JOB"; string username = "JOB";
if (manufactureReceives.Any()) if (manufactureReceives.Any())
{ {
foreach (var data in manufactureReceives) foreach (var data in manufactureReceives)
{ {
log.Info(JsonConvert.SerializeObject(data));
string invCode = data.InvCode; string invCode = data.InvCode;
string workPoint = data.WorkPoint; string workPoint = data.WorkPoint;
decimal quantity = data.Quantity; decimal quantity = data.Quantity;
string rcvCode = data.RCVCode; string rcvCode = data.RCVCode;
string sequence=data.Sequence;
var warehouse = db.ICSWarehouse.SingleOrDefault(e=>e.WarehouseCode==data.WHCode&&e.WorkPoint==data.WorkPoint);
string location = db.ICSLocation.Where(e=>e.WHID== warehouse.ID&&e.WorkPoint==workPoint).FirstOrDefault()?.LocationCode;
string sequence = data.Sequence;
var warehouse = db.ICSWarehouse.SingleOrDefault(e => e.WarehouseCode == data.WHCode && e.WorkPoint == data.WorkPoint);
string location = db.ICSLocation.Where(e => e.WHID == warehouse.ID && e.WorkPoint == workPoint).FirstOrDefault()?.LocationCode;
log.Info(location);
string sql = $@"EXEC Addins_GetSerialCode '{workPoint}','ICSInventoryLot','LotNO','KCP{rcvCode}{sequence}',5;"; string sql = $@"EXEC Addins_GetSerialCode '{workPoint}','ICSInventoryLot','LotNO','KCP{rcvCode}{sequence}',5;";
log.Info(sql);
string lotNo; string lotNo;
log.Info(data.IsSerialNumber);
if (data.IsSerialNumber == "ZS01") if (data.IsSerialNumber == "ZS01")
{ {
var extention = db.ICSExtension.Where(e => e.ID==data.ExtensionID)?.SingleOrDefault();
if (extention!=null)
var extention = db.ICSExtension.Where(e => e.ID == data.ExtensionID)?.SingleOrDefault();
if (extention != null)
{ {
lotNo = extention.BatchCode;
lotNo = extention.BatchCode;
} }
else else
{ {
@ -83,20 +88,22 @@ namespace ICSSoft.FromERP
} }
else else
{ {
log.Info("111");
lotNo = ICSHelper.ExecuteScalar(CommandType.Text, sql).ToString(); lotNo = ICSHelper.ExecuteScalar(CommandType.Text, sql).ToString();
} }
log.Info(lotNo);
//条码 //条码
var inventoryLot = new ICSInventoryLot() var inventoryLot = new ICSInventoryLot()
{ {
ID = AppConfig.GetGuid(), ID = AppConfig.GetGuid(),
LotNo = lotNo, LotNo = lotNo,
InvCode= invCode,
ProductDate=time,
ExpirationDate=time.AddYears(+100),
Quantity= quantity,
Amount=data.Amount,
ExtensionID=data.ExtensionID,
Type="9",
InvCode = invCode,
ProductDate = time,
ExpirationDate = time.AddYears(+100),
Quantity = quantity,
Amount = data.Amount,
ExtensionID = data.ExtensionID,
Type = "9",
MUSER = user, MUSER = user,
MUSERName = username, MUSERName = username,
MTIME = time, MTIME = time,
@ -106,19 +113,19 @@ namespace ICSSoft.FromERP
//库存表 //库存表
var wareHouseLotInfo = new ICSWareHouseLotInfo() var wareHouseLotInfo = new ICSWareHouseLotInfo()
{ {
ID= AppConfig.GetGuid(),
LotNo= lotNo,
WarehouseCode=data.WHCode,
LocationCode=location,
InvCode= invCode,
Quantity= quantity,
InDate=time,
LockQuantity=0,
MUSER= user,
MUSERName= username,
MTIME=time,
WorkPoint= workPoint,
EATTRIBUTE1=""
ID = AppConfig.GetGuid(),
LotNo = lotNo,
WarehouseCode = data.WHCode,
LocationCode = location,
InvCode = invCode,
Quantity = quantity,
InDate = time,
LockQuantity = 0,
MUSER = user,
MUSERName = username,
MTIME = time,
WorkPoint = workPoint,
EATTRIBUTE1 = ""
}; };
//条码单据关联 //条码单据关联
@ -126,43 +133,43 @@ namespace ICSSoft.FromERP
{ {
LotNo = lotNo, LotNo = lotNo,
TransCode = rcvCode, TransCode = rcvCode,
TransSequence= sequence,
MUSER=user,
MUSERName=username,
MTIME=time,
WorkPoint=workPoint,
EATTRIBUTE1=""
TransSequence = sequence,
MUSER = user,
MUSERName = username,
MTIME = time,
WorkPoint = workPoint,
EATTRIBUTE1 = ""
}; };
//出入库记录 //出入库记录
var wareHouseLotInfoLog = new ICSWareHouseLotInfoLog() var wareHouseLotInfoLog = new ICSWareHouseLotInfoLog()
{ {
ID= AppConfig.GetGuid(),
Identification= wareHouseLotInfo.ID,
TransCode= rcvCode,
TransSequence= sequence,
LotNo= lotNo,
InvCode= invCode,
FromWarehouseCode="",
FromLocationCode="",
ToWarehouseCode=data.WHCode,
ToLocationCode=location,
Quantity= quantity,
Memo="",
Lock=false,
TransType="2",
BusinessCode="18",
ERPUpload=false,
ERPID="",
ERPDetailID="",
ERPCode="",
ERPSequence="",
LogID="",
MergeID="",
MUSER=user,
MUSERName=username,
MTIME=time,
WorkPoint=workPoint
ID = AppConfig.GetGuid(),
Identification = wareHouseLotInfo.ID,
TransCode = rcvCode,
TransSequence = sequence,
LotNo = lotNo,
InvCode = invCode,
FromWarehouseCode = "",
FromLocationCode = "",
ToWarehouseCode = data.WHCode,
ToLocationCode = location,
Quantity = quantity,
Memo = "",
Lock = false,
TransType = "2",
BusinessCode = "18",
ERPUpload = false,
ERPID = "",
ERPDetailID = "",
ERPCode = "",
ERPSequence = "",
LogID = "",
MergeID = "",
MUSER = user,
MUSERName = username,
MTIME = time,
WorkPoint = workPoint
}; };

Loading…
Cancel
Save