From 41375594f355e7963ba2ebdf7b26cd06d36c7e03 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周五, 22 8月 2025 08:52:34 +0800
Subject: [PATCH] 222
---
DEmon/iWareDataCore/TASK/Service/MainTaskService.cs | 51 +++++++++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/DEmon/iWareDataCore/TASK/Service/MainTaskService.cs b/DEmon/iWareDataCore/TASK/Service/MainTaskService.cs
index 31e7827..b6065ee 100644
--- a/DEmon/iWareDataCore/TASK/Service/MainTaskService.cs
+++ b/DEmon/iWareDataCore/TASK/Service/MainTaskService.cs
@@ -8,7 +8,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.Serialization;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
namespace iWareDataCore.TASK.Service
@@ -232,46 +234,51 @@
public int SaveOutMainTask(List<int> ida, out string msg)
{
msg = "";
+ var count = 0;
+ List<TASKMainTask> mainTasks = new List<TASKMainTask>();
try
{
using (var dbModel = new DbModelCore())
{
var placematerial = dbModel.BASEPlaceMaterialViews.Where(y => ida.Contains(y.id)).ToList();
- placematerial.ForEach(x =>
+ foreach (var x in placematerial)
{
string matercode = x.materialcode;
var task = dbModel.TASKMainTasks.FirstOrDefault(y => y.materialcode == matercode && y.tasktype == 1);
if (task == null)
{
- MainTaskEntity newtask = new MainTaskEntity()
+ Thread.Sleep(20);
+ TASKMainTask newtask = new TASKMainTask()
{
- TaskNo = DateTime.Now.ToFileTime().ToString(),
- TaskType = 1,
- MaterialCode = matercode,
- SysCode = "1",
- SendTime = DateTime.Now,
- SourcePlace = x.placecode,
- ToPlace = "100202",
- ProcessCardNumber = "",
- Quantity = 1,
- Status = 0,
- DecompositionTime = DateTime.Now,
- WipStatus = 0,
- DecompositionTimes = 0,
- PackageNo = "",
- IsLots = 0,
- Priority = 0,
+ taskno = DateTime.Now.ToFileTime().ToString(),
+ tasktype = 1,
+ materialcode = matercode,
+ syscode = "1",
+ sendtime = DateTime.Now,
+ sourceplace = x.placecode,
+ toplace = "100202",
+ processcardnumber = "0",
+ quantity = 1,
+ status = 0,
+ decompositiontime = DateTime.Now,
+ wipstatus = 0,
+ decompositiontimes = 0,
+ packageno = "",
+ islots = 0,
+ priority = 0,
};
- dbModel.TASKMainTasks.Add(newtask.ToOrm());
+ dbModel.TASKMainTasks.Add(newtask);
+ count += dbModel.SaveChanges();
}
-
- });
- return dbModel.SaveChanges();
+ }
+
+ return count;
}
}
catch (Exception ex)
{
+ LogTextHelper.WriteLine(Resources.LogDir + "@/MainTask/", ex.Message + "浼犲叆鍙傛暟" + string.Join(";",ida));
msg = ex.Message;
return -1;
}
--
Gitblit v1.9.3