dengjunjie
7 天以前 f40ba2a9fb9d3c2ece08e9a7cd987d4744dccab2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Model.Models;
 
namespace WIDESEAWCS_TaskInfoService
{
    public partial class TaskService
    {
        /// <summary>
        /// 人工操作任务
        /// 1:完成;2:取消
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public WebResponseContent ManualTask(SaveModel saveModel)
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            try
            {
                var Tasks = BaseDal.QueryData(x => saveModel.DelKeys.Contains(x.TaskId));
                if (Tasks.Where(x => !TaskInboundTypes.Contains(x.TaskType)).Any()) throw new Exception("只可取消入库任务");
                if (Tasks.Where(x => x.TaskState > TaskInStatusEnum.AGV_InFinish.ObjToInt()).Any()) throw new Exception("暂不可取消已上输送线任务");
                //var UserName = App.User?.UserName;
                Tasks.ForEach(x =>
                {
                    x.TaskState = TaskInStatusEnum.InCancel.ObjToInt();
                    //x.Modifier = UserName;
                    //x.ModifyDate = DateTime.Now;
                });
                BaseDal.UpdateData(Tasks);
                webResponseContent.OK();
            }
            catch (Exception ex)
            {
                webResponseContent.Error(ex.Message);
            }
            return webResponseContent;
        }
        public WebResponseContent ModifyBarcode(WMSTaskDTO wMSTask)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                Dt_Task? dt_Task = BaseDal.QueryFirst(x => x.TaskNum == wMSTask.TaskNum);
                if (dt_Task == null) throw new Exception($"WCS未找到任务,任务号:【{wMSTask.TaskNum}】");
                dt_Task.PalletCode = wMSTask.PalletCode;
                BaseDal.UpdateData(dt_Task);
                content.OK();
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}