分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-06-07 fdf6494705b9bcddb2e16b933b231262497fc227
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Services/ToMES/Partial/dt_mes_headService.cs
@@ -21,6 +21,7 @@
using WIDESEA_WCS.JobsPart.Common;
using WIDESEA_Core.ManageUser;
using WIDESEA_Comm.LogInfo;
using System.Collections.Generic;
namespace WIDESEA_WCS.Services
{
@@ -41,20 +42,20 @@
            //多租户会用到这init代码,其他情况可以不用
            //base.Init(dbRepository);
        }
        public WebResponseContent OutsorcingWorkOrder(SaveModel model)
        public WebResponseContent CancelsorcingWorkOrder(SaveModel saveModel)
        {
            WebResponseContent content = new WebResponseContent();
            string compeletor = UserContext.Current.UserName;
            List<string> list = new List<string>();
            try
            {
                List<string> list = new List<string>();
                foreach (var Key in model.DelKeys)
                foreach (var Key in saveModel.DelKeys)
                {
                    var mes_head = _repository.Find(x => x.mes_id.ToString() == Key.ToString()).FirstOrDefault();
                    if (mes_head != null)
                    {
                        mes_head.area = "外协";
                        _repository.Update(mes_head, true);
                        mes_head.area = null;
                        _repository.Update(mes_head, x => new { x.area }, true);
                        list.Add(mes_head.jobID);
                    }
                }
@@ -63,7 +64,33 @@
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("指定工单出库外协", $"错误信息:{ex.Message}", "PCS", compeletor);
                WriteDBLog.Error("取消工单出库外协", $"工单编号:{list}\n错误信息:{ex.Message}", "PCS", compeletor);
            }
            return content;
        }
        public WebResponseContent OutsorcingWorkOrder(SaveModel model)
        {
            WebResponseContent content = new WebResponseContent();
            string compeletor = UserContext.Current.UserName;
            List<string> list = new List<string>();
            try
            {
                foreach (var Key in model.DelKeys)
                {
                    var mes_head = _repository.Find(x => x.mes_id.ToString() == Key.ToString()).FirstOrDefault();
                    if (mes_head != null)
                    {
                        mes_head.area = "外协";
                        _repository.Update(mes_head, x => new { x.area }, true);
                        list.Add(mes_head.jobID);
                    }
                }
                content.OK();
                WriteDBLog.Success("指定工单出库外协", $"工单编号:{list}", "PCS", compeletor);
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("指定工单出库外协", $"工单编号:{list}\n错误信息:{ex.Message}", "PCS", compeletor);
            }
            return content;
        }