林豪 左 hace 1 año
padre
commit
06d28d91af

+ 16 - 9
wms.api/Controllers/BaseController.cs

@@ -1,12 +1,9 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
 using Newtonsoft.Json;
 using System.Diagnostics;
 using wms.dto.request;
 using wms.dto.response;
-using wms.service;
 using wms.service.IService;
-using wms.util.Check;
 using wms.util.Ext;
 using wms.util.Http;
 
@@ -22,27 +19,33 @@ namespace wms.api.Controllers
         private readonly ISXService _sxService;
         private readonly ICPService _cpService;
         private readonly ILogger<BaseController> _logger;
-        public BaseController(IHJService hJService ,ILogger<BaseController> logger)
+
+        public BaseController(IHJService hJService, ILogger<BaseController> logger)
         {
             _hJService = hJService;
             _logger = logger;
         }
+
         public BaseController(IPTService ptService)
         {
             _ptService = ptService;
         }
+
         public BaseController(IFJService fjService)
         {
             _fjService = fjService;
         }
+
         public BaseController(ISXService sxService)
         {
             _sxService = sxService;
         }
+
         public BaseController(ICPService cpService)
         {
             _cpService = cpService;
         }
+
         /// <summary>
         /// 发送ESB请求统一出口
         /// </summary>
@@ -52,7 +55,7 @@ namespace wms.api.Controllers
         {
             var res = new SRes();
             //var aa = (new StackTrace()).GetFrame(0).GetMethod().Name;//当前方法名
-            var methodName = (new StackTrace()).GetFrame(1).GetMethod().Name;//调用的方法名称                                                 
+            var methodName = (new StackTrace()).GetFrame(1).GetMethod().Name;//调用的方法名称
             string methodcode = "";
             if (_ptService != null)
             {
@@ -69,7 +72,7 @@ namespace wms.api.Controllers
             }
             methodcode = RedisHelper.Get("sys_config" + methodName);
             var reqid = Guid.NewGuid().ToString();
-            var req = new EsbReq() { headers = new HeadersReq() { serviceCode = methodcode.Split("|")[0],requestId = reqid,TrackId = reqid } };
+            var req = new EsbReq() { headers = new HeadersReq() { serviceCode = methodcode.Split("|")[0], requestId = reqid, TrackId = reqid } };
             //req.Body = strReqBody;
             string sysname = methodcode.Split("|")[1];
             var apiurl = "";
@@ -89,10 +92,11 @@ namespace wms.api.Controllers
             }
             else
             {
-                res = new SRes() { ResMsg = "MES没有返回任务数据",ResCode = 500,Memo1 = apiurl,Memo2 = req.ToJsonString(),Memo3 = strEsbRes };
+                res = new SRes() { ResMsg = "MES没有返回任务数据", ResCode = 500, Memo1 = apiurl, Memo2 = req.ToJsonString(), Memo3 = strEsbRes };
             }
             return res.ToCamelCaseString();
         }
+
         /// <summary>
         /// 并发管控
         /// </summary>
@@ -134,7 +138,10 @@ namespace wms.api.Controllers
                 res.ResMsg = ex.Message;
                 return res;
             }
+            finally
+            {
+                RedisHelper.Del(key);
+            }
         }
-
     }
 }

+ 55 - 1
wms.api/Controllers/FjController.cs

@@ -57,6 +57,21 @@ namespace wms.api.Controllers
         /// </summary>
         private static object lockOneFloorWorkerBuildEmptyPalletsStock = new object();
 
+        /// <summary>
+        ///  申请货位
+        /// </summary>
+        private static object lockApplyStockInLoc = new object();
+
+        /// <summary>
+        ///  完成任务
+        /// </summary>
+        private static object lockerCompleteTask = new object();
+
+        /// <summary>
+        ///  手动出库任务
+        /// </summary>
+        private static object lockManualTask = new object();
+
         private static object lockerBomInfoTrans = new object();
 
         #endregion 锁
@@ -471,11 +486,50 @@ namespace wms.api.Controllers
         [HttpPost]
         public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto)
         {
-            return ConcurrencyReqControl<FJBuildEmptyPalletsStockRequest, SRes>(lockOneFloorWorkerBuildEmptyPalletsStock, "OneFloorWorkerBuildEmptyPalletsStock" + reqDto.PalletCode, reqDto.PalletCode, reqDto, _fjService.OneFloorWorkerBuildEmptyPalletsStock);
+            return ConcurrencyReqControl<FJBuildEmptyPalletsStockRequest, SRes>(lockOneFloorWorkerBuildEmptyPalletsStock, "OneFloorWorkerBuildEmptyPalletsStock" + reqDto.PalletCode, reqDto.StartLoc, reqDto, _fjService.OneFloorWorkerBuildEmptyPalletsStock);
         }
 
         #endregion 一楼入库任务生成接口
 
+        /// <summary>
+        ///   申请货位
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public SRes ApplyStockInLoc(FJApplyStockInLocRequest reqDto)
+        {
+            return ConcurrencyReqControl<FJApplyStockInLocRequest, SRes<FJApplyStockInLocResponse>>(lockApplyStockInLoc, "ApplyStockInLoc" + reqDto.TaskNum, reqDto.PickUpEquipmentNo, reqDto, _fjService.ApplyStockInLoc);
+        }
+
+        /// <summary>
+        /// 手动出库
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public string ManualTask(FJManualTaskRequest request)
+        {
+            lock (lockManualTask)
+            {
+                return _fjService.ManualTask(request);
+            }
+        }
+
+        /// <summary>
+        /// 完成任务
+        /// </summary>
+        /// <param name="reqEntity"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
+        {
+            lock (lockerCompleteTask)
+            {
+                return _fjService.CompleteTask(reqDto);
+            }
+        }
+
         #region 生成货位基础配置
 
         /// <summary>

+ 9 - 3
wms.dto/const/FJEnumClass.cs

@@ -17,19 +17,25 @@ namespace wms.dto
         ///  一楼人工入空托盘
         /// </summary>
         [Description("一楼人工入空托盘")]
-        OneLayerManualPallets = 1,
+        OneLayerManualPallets = 1, 
 
         /// <summary>
         ///  一楼自动入空托盘
         /// </summary>
         [Description("一楼自动入空托盘")]
-        OneLayerAutoPallets = 2
+        OneLayerAutoPallets = 2,
+
+        /// <summary>
+        ///  手动出库
+        /// </summary>
+        [Description("手动出库")]
+        TaskBusType_FJ_ManualOut = 2
     }
 
     /// <summary>
     ///  托盘类型
     /// </summary>
-    public enum PalletType
+    public enum FJPalletType
     {
         /// <summary>
         ///  09使用的托盘

+ 2 - 2
wms.dto/request/fj/BuildEmptyPalletsStockRequest.cs

@@ -17,7 +17,7 @@ namespace wms.dto.request.fj
         /// <summary>
         ///  托盘类型
         /// </summary>
-        public PalletType PalletType { get; set; }
+        public FJPalletType PalletType { get; set; }
 
         /// <summary>
         ///  入库起始地址
@@ -52,7 +52,7 @@ namespace wms.dto.request.fj
         /// <summary>
         ///  托盘类型
         /// </summary>
-        public PalletType PalletType { get; set; }
+        public FJPalletType PalletType { get; set; }
 
         /// <summary>
         ///  托盘数量

+ 27 - 0
wms.dto/request/fj/FJApplyStockInLocRequest.cs

@@ -0,0 +1,27 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace wms.dto.request.fj
+{
+    /// <summary>
+    ///  分拣申请货位
+    /// </summary>
+    public class FJApplyStockInLocRequest : BaseRequest
+    {
+        /// <summary>
+        /// WMS任务号
+        /// </summary>
+        [Required(ErrorMessage = "{0} 不可为空")]
+        public int TaskNum { get; set; }
+
+        /// <summary>
+        /// 巷道号
+        /// </summary>
+        public int TunnelNum { get; set; }
+
+        /// <summary>
+        /// 取货地点设备编号
+        /// </summary>
+        [Required(ErrorMessage = "{0} 不可为空")]
+        public string PickUpEquipmentNo { get; set; }
+    }
+}

+ 20 - 0
wms.dto/request/fj/FJManualTaskRequest.cs

@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+
+namespace wms.dto.request.fj
+{
+    /// <summary>
+    ///  手动出库请求
+    /// </summary>
+    public class FJManualTaskRequest
+    {
+        /// <summary>
+        ///  货位信息
+        /// </summary>
+        public List<string> Location { get; set; }
+
+        /// <summary>
+        ///  业务类型
+        /// </summary>
+        public string? BusType { get; set; }
+    }
+}

+ 38 - 0
wms.dto/response/fj/FJApplyLocRequest.cs

@@ -0,0 +1,38 @@
+namespace wms.dto.response.fj
+{
+    /// <summary>
+    ///
+    /// </summary>
+    public class FJApplyLocRequest
+    {
+        /// <summary>
+        ///  仓库号
+        /// </summary>
+        public long WarehuoseId { get; set; }
+
+        /// <summary>
+        ///  大小
+        /// </summary>
+        public int Size { get; set; }
+
+        /// <summary>
+        ///  巷道号
+        /// </summary>
+        public int TunnelNum { get; set; }
+
+        /// <summary>
+        ///  物料ID
+        /// </summary>
+        public long MaterialId { get; set; }
+
+        /// <summary>
+        /// 物料编号
+        /// </summary>
+        public string MaterialCode { get; set; }
+
+        /// <summary>
+        ///  是否移库
+        /// </summary>
+        public bool IsMove { get; set; } = false;
+    }
+}

+ 33 - 0
wms.dto/response/fj/FJApplyStockInLocResponse.cs

@@ -0,0 +1,33 @@
+namespace wms.dto.response.fj
+{
+    /// <summary>
+    ///  分拣申请货位返回接口
+    /// </summary>
+    public class FJApplyStockInLocResponse
+    {
+        /// <summary>
+        /// 货位号
+        /// </summary>
+        public string CellNo { get; set; }
+
+        /// <summary>
+        /// 巷道号
+        /// </summary>
+        public string TunnelNum { get; set; }
+
+        /// <summary>
+        /// 行
+        /// </summary>
+        public int Row { get; set; }
+
+        /// <summary>
+        /// 列
+        /// </summary>
+        public int Colomn { get; set; }
+
+        /// <summary>
+        /// 层
+        /// </summary>
+        public int Layer { get; set; }
+    }
+}

+ 29 - 7
wms.service/IService/IFJService.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq.Expressions;
 using wms.dto.request.fj;
+using wms.dto.request.share;
 using wms.dto.response;
 using wms.dto.response.fj;
 using wms.sqlsugar.model;
@@ -57,13 +58,6 @@ namespace wms.service.IService
 
         public SRes StockChange(FjStockChangeRequest reqDto);
 
-        /// <summary>
-        ///  一楼空托盘人工入库任务创建
-        /// </summary>
-        /// <param name="reqDto"></param>
-        /// <returns></returns>
-        public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto);
-
         public SRes BomInfoTrans(BomInfoTransRequest reqDto);
 
         public SRes CurtainOrderStartCheck(CurtainOrderStartCheckRequest reqDto);
@@ -79,5 +73,33 @@ namespace wms.service.IService
         /// </summary>
         /// <returns></returns>
         public SRes FJSouthAutoGenerateLocation();
+
+        /// <summary>
+        ///  一楼空托盘人工入库任务创建
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        public SRes OneFloorWorkerBuildEmptyPalletsStock(FJBuildEmptyPalletsStockRequest reqDto);
+
+        /// <summary>
+        ///  申请货位
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        public SRes<FJApplyStockInLocResponse> ApplyStockInLoc(FJApplyStockInLocRequest reqDto);
+
+        /// <summary>
+        ///  手动出库
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        public string ManualTask(FJManualTaskRequest reqDto);
+
+        /// <summary>
+        ///  完成任务
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        public SRes<int> CompleteTask(CompleteTaskRequest reqDto);
     }
 }

+ 605 - 52
wms.service/Service/FJService.cs

@@ -12,6 +12,7 @@ using wms.dataservice.IDataSetvice;
 using wms.dto;
 using wms.dto.request;
 using wms.dto.request.fj;
+using wms.dto.request.share;
 using wms.dto.response;
 using wms.dto.response.fj;
 using wms.service.IService;
@@ -58,6 +59,9 @@ namespace wms.service.Service
         /// </summary>
         private Repository<BaseContinfo> _baseContinfo => new Repository<BaseContinfo>();
 
+        /// <summary>
+        ///  当前任务表
+        /// </summary>
         private RepositoryTask<WCS_TaskInfo> _taskrepository => new RepositoryTask<WCS_TaskInfo>();
 
         /// <summary>
@@ -93,7 +97,14 @@ namespace wms.service.Service
         /// </summary>
         private RepositoryTask<WCS_TaskOld> _wcstaskoldrepository => new RepositoryTask<WCS_TaskOld>();
 
+        /// <summary>
+        ///  流水表
+        /// </summary>
         private Repository<BillInvflow> _billInvflow => new Repository<BillInvflow>();
+
+        /// <summary>
+        ///  甲方管理系统推送反馈
+        /// </summary>
         private Repository<BillPushinfo> _billPushinforepository => new Repository<BillPushinfo>();
 
         /// <summary>
@@ -574,12 +585,12 @@ namespace wms.service.Service
             req.BusType = FJTaskBusType.OneLayerManualPallets;
 
             //TODO:条码长度待定
-            if (reqDto.PalletCode.Length != 12)
-            {
-                res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
-                res.ResMsg = "MES上传的RFID长度不等于12位";
-                return res;
-            }
+            //if (reqDto.PalletCode.Length != 12)
+            //{
+            //    res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
+            //    res.ResMsg = "MES上传的RFID长度不等于12位";
+            //    return res;
+            //}
             res = FJEmptyPalletsStockIn(req);
 
             return res;
@@ -604,23 +615,23 @@ namespace wms.service.Service
             }
 
             //验证是否有空余货位
-            res = (CopperLineResponse)IsThereAnySpaceVacancy();
+            res = _mapper.Map<CopperLineResponse>(IsThereAnySpaceVacancy());
             if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode()) return res;
 
             //检查仓库是否存在
-            res = (CopperLineResponse)CheckWareCode(reqDto.WareCode);
+            res = _mapper.Map<CopperLineResponse>(CheckWareCode(reqDto.WareCode));
             if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode()) return res;
 
             //验证容器是否存在
-            res = (CopperLineResponse)CheckContinfo(reqDto.PalletCode, FJContainerType.ContainerType_Pallet);
+            res = _mapper.Map<CopperLineResponse>(CheckContinfo(reqDto.PalletCode, FJContainerType.ContainerType_Pallet));
             if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode()) return res;
 
             //验证托盘是否有未结束的任务
-            res = (CopperLineResponse)CheckNoFinishTask(reqDto.PalletCode);
+            res = _mapper.Map<CopperLineResponse>(CheckNoFinishTask(reqDto.PalletCode));
             if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode()) return res;
 
             //验证是否存在库存信息
-            res = (CopperLineResponse)CheckInvnow(reqDto.PalletCode);
+            res = _mapper.Map<CopperLineResponse>(CheckInvnow(reqDto.PalletCode));
             if (res.ResCode != ResponseStatusCodeEnum.Sucess.GetHashCode()) return res;
 
             //保存条码信息 空托盘条码即条码表条码
@@ -642,6 +653,7 @@ namespace wms.service.Service
                     InvStateCode = FJInvState.InvEcecState_BuildUp.ToString(),
                     SuppCode = "",
                     Size = 1,
+                    MatCode = reqDto.PalletCode,
                     AddTime = DateTime.Now,
                 };
 
@@ -661,7 +673,7 @@ namespace wms.service.Service
             {
                 BusType = BusType.GetDescription(),
                 ContGrpBarCode = reqDto.PalletCode,
-                ContGrpId = createStockRes.ResData.ContGrpId,
+                ContGrpId = createStockRes.ResDataList.First().ContGrpId,
                 Qty = reqDto.PalletNum.ObjToDecimal(),
                 EquCode = reqDto.StartLoc,
                 WarehouseCode = reqDto.WareCode,
@@ -677,7 +689,7 @@ namespace wms.service.Service
                 return res;
             }
             //生成流水数据-分解方法
-            CreateInvFlow(new List<BillInvnow>() { createStockRes.ResData });
+            CreateInvFlow(createStockRes.ResDataList);
 
             return res;
         }
@@ -794,7 +806,7 @@ namespace wms.service.Service
             {
                 Id = IdFactory.NewId(),
                 IsStop = 0,
-                Code = "fj1northhouse",
+                Code = "1N",
                 Name = "分拣库1北",
                 AddTime = DateTime.Now
 ,
@@ -810,20 +822,6 @@ namespace wms.service.Service
             var codes = new List<string>();
             for (int row = 1; row <= 2; row++) //行
             {
-                //shelfcode = "L";
-                ////1 2 是R, 3 4 是 L
-                //if (row == 1 || row == 2 || row == 5 || row == 6 || row == 9 || row == 10)
-                //{
-                //    shelfcode = "R";
-                //}
-
-                //// 23 深度1 , 1 4   5 8   9  12深度2
-                //int depth = 1;
-                //if (row == 1 || row == 4 || row == 5 || row == 8 || row == 9 || row == 12)
-                //{
-                //    depth = 2;
-                //}
-
                 int tunnel = 1;
 
                 //12行 48列9层
@@ -846,7 +844,7 @@ namespace wms.service.Service
                             TypeNum = 1,
                             Size = 1,
                             Shelf = tunnel.ToString() + shelfcode,
-                            WarehouseCode = "fj1northhouse",
+                            WarehouseCode = BaseWarearea.Code,
                             Row = row,
                             Col = col,
                             Layer = layer,
@@ -877,7 +875,7 @@ namespace wms.service.Service
             {
                 Id = IdFactory.NewId(),
                 IsStop = 0,
-                Code = "fj1southhouse",
+                Code = "1S",
                 Name = "分拣库1南",
                 AddTime = DateTime.Now
 ,
@@ -895,20 +893,6 @@ namespace wms.service.Service
             var codes = new List<string>();
             for (int row = 1; row <= 2; row++) //行
             {
-                //shelfcode = "L";
-                ////1 2 是R, 3 4 是 L
-                //if (row == 1 || row == 2 || row == 5 || row == 6 || row == 9 || row == 10)
-                //{
-                //    shelfcode = "R";
-                //}
-
-                //// 23 深度1 , 1 4   5 8   9  12深度2
-                //int depth = 1;
-                //if (row == 1 || row == 4 || row == 5 || row == 8 || row == 9 || row == 12)
-                //{
-                //    depth = 2;
-                //}
-
                 int tunnel = 1;
 
                 //12行 48列9层
@@ -931,7 +915,7 @@ namespace wms.service.Service
                             TypeNum = 1,
                             Size = 1,
                             Shelf = tunnel.ToString() + shelfcode,
-                            WarehouseCode = "fj1southhouse",
+                            WarehouseCode = BaseWarearea.Code,
                             Row = row,
                             Col = col,
                             Layer = layer,
@@ -954,6 +938,202 @@ namespace wms.service.Service
             return res;
         }
 
+        #region 巷道及货位分配
+
+        /// <summary>
+        /// 分配货位
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public SRes<FJApplyStockInLocResponse> ApplyStockInLoc(FJApplyStockInLocRequest reqEntity)
+        {
+            var res = ApplyStockInLocTemp(reqEntity);
+            if (string.IsNullOrEmpty(res.ResData.CellNo))
+            {
+                return res;
+            }
+
+            try
+            {
+                var task = _taskrepository.GetFirst(p => p.ID == reqEntity.TaskNum);
+                var stock = _billInvnowrepository.GetFirst(p => p.ContGrpBarCode == task.BarCode && p.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
+                _db.BeginTran();
+
+                //更新货位
+                _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell() { StateNum = LocationState.LocationState_StockIn.GetHashCode(), ContGrpBarCode = "", ContGrpId = 0, EditTime = DateTime.Now },
+                       p => p.Code == res.ResData.CellNo);
+                //更新任务
+                //_wcstaskoldrepository.UpdateModelColumns(p => new WCS_TaskOld() { AddrTo = res.ResData.CellNo,  EditTime = DateTime.Now },
+                //       p => p.ID == reqEntity.TaskNum);
+                //_taskrepository.UpdateModelColumns(p => new WCS_TaskInfo() { AddrTo = res.ResData.CellNo,  EditTime = DateTime.Now },
+                //       p => p.ID == reqEntity.TaskNum);
+                _db.CommitTran();
+            }
+            catch (Exception ex)
+            {
+                _db.RollbackTran();
+                _logger.LogInformation(ex.ToString());
+            }
+            return res;
+        }
+
+        /// <summary>
+        /// 分配货位
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public SRes<FJApplyStockInLocResponse> ApplyStockInLocTemp(FJApplyStockInLocRequest reqEntity)
+        {
+            var result = new SRes<FJApplyStockInLocResponse>()
+            {
+                ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(),
+                ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription(),
+                ResData = new FJApplyStockInLocResponse()
+            };
+            //检擦任务是否异常
+            var wcstask = _wcstaskoldrepository.AsQueryable().SplitTable(tabs => tabs.Take(3)).Where(p => p.ID == reqEntity.TaskNum).First(); ;
+            if (wcstask == null)
+            {
+                result.ResCode = ResponseStatusCodeEnum.WcsTaskNotExist.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.WcsTaskNotExist.GetDescription();
+                return result;
+            }
+            if (wcstask.Type == TaskType.OutDepot)
+            {
+                result.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
+                result.ResMsg = "该任务是出库任务,不能分配货位;wms任务号" + wcstask.ID;
+                return result;
+            }
+            if (!string.IsNullOrEmpty(wcstask.AddrTo) && wcstask.AddrTo != "SRM")//如果目标地址不是堆垛机
+            {
+                result.ResData.TunnelNum = wcstask.Tunnel;
+                result.ResData.CellNo = wcstask.AddrTo;
+                result.ResData.Row = wcstask.AddrTo.Split('-')[0] != null ? int.Parse(wcstask.AddrTo.Split('-')[0]) : 0;
+                result.ResData.Colomn = wcstask.AddrTo.Split('-')[1] != null ? int.Parse(wcstask.AddrTo.Split('-')[1]) : 0;
+                result.ResData.Layer = wcstask.AddrTo.Split('-')[2] != null ? int.Parse(wcstask.AddrTo.Split('-')[2]) : 0;
+                return result;
+            }
+            if (reqEntity.TunnelNum <= 0)
+            {
+                result.ResCode = ResponseStatusCodeEnum.NotTunnelNum.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.NotTunnelNum.GetDescription();
+                return result;
+            }
+            //验证仓库信息
+            var warehouse = _basewarehouserepository.GetFirst(p => p.Code == wcstask.WarehouseCode);
+            if (warehouse == null)
+            {
+                result.ResCode = ResponseStatusCodeEnum.WarehouseCodeNotExist.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.WarehouseCodeNotExist.GetDescription();
+                return result;
+            }
+            //验证库存
+            var stock = _billInvnowrepository.GetFirst(p => p.ContGrpBarCode == wcstask.BarCode && p.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
+            if (stock == null)
+            {
+                result.ResCode = ResponseStatusCodeEnum.StockNotExist.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.StockNotExist.GetDescription();
+                return result;
+            }
+            if (reqEntity.TunnelNum <= 0)
+            {
+                result.ResCode = ResponseStatusCodeEnum.ErrParam.GetHashCode();
+                result.ResMsg = "没有传巷道值";
+                return result;
+            }
+
+            return ApplyLoc(new FJApplyLocRequest()
+            {
+                MaterialId = stock.MatId,
+                MaterialCode = stock.MatCode,
+                Size = stock.Size,
+                TunnelNum = reqEntity.TunnelNum,
+                WarehuoseId = warehouse.Id,
+                IsMove = wcstask.Type == TaskType.TransferDepot
+            });
+        }
+
+        /// <summary>
+        ///  分配货位
+        /// </summary>
+        /// <param name="reqEntity"></param>
+        /// <returns></returns>
+        public SRes<FJApplyStockInLocResponse> ApplyLoc(FJApplyLocRequest reqEntity)
+        {
+            var result = new SRes<FJApplyStockInLocResponse>()
+            {
+                ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(),
+                ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription(),
+                ResData = new FJApplyStockInLocResponse()
+            };
+
+            //预留货位数量
+            var emptyLoc = _basewarecellrepository.GetList(p => p.IsStop == 0
+            && p.StateNum == LocationState.LocationState_Empty.GetHashCode()
+            && p.TypeNum == LocationType.LocationType_StorageLocation.GetHashCode()
+            && p.Tunnel == reqEntity.TunnelNum
+            && p.WarehouseId == reqEntity.WarehuoseId
+            && p.Size == reqEntity.Size
+            );
+
+            //判断是否移库
+            if (!reqEntity.IsMove && (emptyLoc == null || emptyLoc.Count < 2))
+            {
+                result.ResCode = ResponseStatusCodeEnum.NotEnoughLocation.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.NotEnoughLocation.GetDescription();
+                return result;
+            }
+
+            //找到可用货位
+            var loc1ist = _basewarecellrepository.Context
+                         .Queryable<BaseWarecell>()
+                         .Where((loc1) => loc1.IsStop == 0
+                                            && loc1.StateNum == LocationState.LocationState_Empty.GetHashCode()
+                                            && loc1.TypeNum == LocationType.LocationType_StorageLocation.GetHashCode()
+                                            && loc1.Tunnel == reqEntity.TunnelNum
+                                            && loc1.WarehouseId == reqEntity.WarehuoseId
+                                            && loc1.Size == reqEntity.Size
+                                            && loc1.Depth == 1)
+                         .Where((loc1) => loc1.Tunnel == reqEntity.TunnelNum)
+                         .Select((loc1) => new
+                         {
+                             loc1.Code,
+                             loc1.Id,
+                             loc1.Row,
+                             loc1.Col,
+                             loc1.Layer,
+                             loc1.Tunnel,
+                         });
+
+            if (loc1ist != null)
+            {
+                var resloc = loc1ist.ToList().OrderBy(p => p.Layer).ThenBy(p => p.Col).ThenBy(p => p.Row).First();
+                result.ResData.TunnelNum = resloc.Tunnel.ToString();
+                result.ResData.CellNo = resloc.Code;
+                result.ResData.Row = resloc.Row;
+                result.ResData.Colomn = resloc.Col;
+                result.ResData.Layer = resloc.Layer;
+                return result;
+            }
+
+            if (loc1ist == null || !loc1ist.Any())
+            {
+                result.ResCode = ResponseStatusCodeEnum.NotEnoughLocation.GetHashCode();
+                result.ResMsg = ResponseStatusCodeEnum.NotEnoughLocation.GetDescription();
+                return result;
+            }
+
+            var loc = loc1ist.First();
+            result.ResData.TunnelNum = loc.Tunnel.ToString();
+            result.ResData.CellNo = loc.Code;
+            result.ResData.Row = loc.Row;
+            result.ResData.Colomn = loc.Col;
+            result.ResData.Layer = loc.Layer;
+            return result;
+        }
+
+        #endregion 巷道及货位分配
+
         #region 容器、物料、条码、库存检测及创建,创建流水信息
 
         /// <summary>
@@ -1213,7 +1393,7 @@ namespace wms.service.Service
                 Device = "",
                 SrmStation = "",
                 AddrFrom = reqDto.EquCode,
-                AddrTo = "srm",
+                AddrTo = "SRM",
                 LastInteractionPoint = "",
                 BarCode = reqDto.ContGrpBarCode,
                 Floor = reqDto.Floor,
@@ -1223,12 +1403,12 @@ namespace wms.service.Service
                 DocID = 0,
                 PalletType = 1,
                 ProdLine = 0,
-                AddWho = "wms",
+                AddWho = "WMS",
                 WarehouseCode = reqDto.WarehouseCode,
                 Enabled = true,
-                WorkBench = reqDto.EquCode,
-                MaterialCode = reqDto.MaterialCode,
-                MatCode = reqDto.MatCode,
+                //WorkBench = reqDto.EquCode,
+                //MaterialCode = reqDto.MaterialCode,
+                //MatCode = reqDto.MatCode,
                 BusType = reqDto.BusType
             };
             var wcstaskhis = _mapper.Map<WCS_TaskOld>(wcstask);
@@ -1244,10 +1424,10 @@ namespace wms.service.Service
                     ID = Guid.NewGuid(),
                     CurPoint = reqDto.EquCode,
                     AddTime = DateTime.Now,
-                    AddWho = "wms",
+                    AddWho = "WMS",
                     Enabled = true,
                     ParentTaskCode = task.ID,
-                    Desc = reqDto.EquCode + "分拣一楼空托入库",
+                    Desc = reqDto.EquCode + "分拣一楼空托入库",
                 };
                 _taskdetailrepository.InsertableSplitTable(taskdetail);
                 _db.CommitTran();
@@ -1265,5 +1445,378 @@ namespace wms.service.Service
         }
 
         #endregion 容器、物料、条码、库存检测及创建,创建流水信息
+
+        /// <summary>
+        ///  手动出库
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public string ManualTask(FJManualTaskRequest request)
+        {
+            var res = new SRes();
+
+            //必须要有货位信息
+            if (!request.Location.Any())
+            {
+                res.ResCode = ResponseStatusCodeEnum.ErrParamNotNull.GetHashCode();
+                res.ResMsg = "货位" + ResponseStatusCodeEnum.ErrParamNotNull.GetDescription();
+                return res.ToCamelCaseString();
+            }
+            try
+            {
+                foreach (var item in request.Location)
+                {
+                    //货位信息验证
+                    var location = _basewarecellrepository.GetSingle(p => p.Code == item);
+                    if (location == null)
+                    {
+                        res.ResCode = ResponseStatusCodeEnum.WareLocationCodeNotExist.GetHashCode();
+                        res.ResMsg = item + ResponseStatusCodeEnum.WareLocationCodeNotExist.GetDescription();
+                        return res.ToCamelCaseString();
+                    }
+                    if (location.StateNum != FJLocationState.LocationState_Full.GetHashCode())
+                    {
+                        res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
+                        res.ResMsg = item + ResponseStatusCodeEnum.Fail.GetDescription() + "货位状态不满足出库条件";
+                        return res.ToCamelCaseString();
+                    }
+                    if (location.IsStop == 1)
+                    {
+                        res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
+                        res.ResMsg = ResponseStatusCodeEnum.Fail.GetDescription() + item + "被禁用";
+                        return res.ToCamelCaseString();
+                    }
+
+                    //库存信息验证
+                    var stock = _billInvnowrepository.GetSingle(p => p.ContGrpBarCode == location.ContGrpBarCode && p.InvStateCode == InvState.InvEcecState_In.ToString());
+                    if (stock == null)
+                    {
+                        res.ResCode = ResponseStatusCodeEnum.StockNotExist.GetHashCode();
+                        res.ResMsg = ResponseStatusCodeEnum.StockNotExist.GetDescription();
+                        return res.ToCamelCaseString();
+                    }
+                    if (stock.InvStateCode != InvState.InvEcecState_In.ToString())
+                    {
+                        res.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
+                        res.ResMsg = item + "组盘状态不是已入库";
+                        return res.ToCamelCaseString();
+                    }
+
+                    WCS_TaskInfo billTask = new WCS_TaskInfo();
+                    billTask.Status = TaskStatus.NewBuild;
+                    billTask.Type = TaskType.OutDepot;
+                    billTask.Priority = 0;
+                    billTask.Device = "SRM" + location.Tunnel;
+                    billTask.AddrFrom = item;
+                    billTask.BarCode = stock.ContGrpBarCode;
+                    billTask.StartTime = DateTime.Now;
+                    billTask.AddTime = DateTime.Now;
+                    billTask.EditTime = DateTime.Now;
+                    billTask.AddWho = "WMS";
+                    billTask.WarehouseCode = location.WarehouseCode;
+                    billTask.Enabled = true;
+                    billTask.Floor = 2;
+                    billTask.Tunnel = location.Tunnel.ToString();
+                    billTask.PalletType = 1;
+                    billTask.Length = stock.LengthQty;
+                    billTask.MaterialCode = stock.MatCode;
+                    billTask.OutType = OutTypeEnum.半自动手动出库任务;
+                    billTask.BusType = FJTaskBusType.TaskBusType_FJ_ManualOut.GetDescription();
+
+                    _db.BeginTran();
+
+                    var wcs = _taskrepository.InsertReturnEntity(billTask);
+                    var wcshistory = _mapper.Map<WCS_TaskOld>(wcs);
+                    _wcstaskoldrepository.InsertableSplitTable(wcshistory);
+                    var taskdetail = new WCS_TaskDtl()
+                    {
+                        ID = Guid.NewGuid(),
+                        CurPoint = item,
+                        AddTime = DateTime.Now,
+                        AddWho = "wms",
+                        Enabled = true,
+                        ParentTaskCode = wcs.ID,
+                        Desc = wcs.OutType.ToString(),
+                    };
+                    _taskdetailrepository.InsertableSplitTable(taskdetail);
+                    _db.CommitTran();
+
+                    _basewarecellrepository.UpdateSetColumnsTrue(p => new BaseWarecell()
+                    {
+                        StateNum = LocationState.LocationState_StockOut.GetHashCode(),
+                        EditTime = DateTime.Now
+                    }, p => p.Code == item);
+                    _billInvnowrepository.UpdateSetColumnsTrue(p => new BillInvnow()
+                    {
+                        InvStateCode = InvState.InvEcecState_OutGoing.ToString(),
+                        EditTime = DateTime.Now
+                    }, p => p.ContGrpBarCode == stock.ContGrpBarCode);
+
+                    var flow = _mapper.Map<BillInvflow>(stock);
+                    flow.Id = IdFactory.NewId();
+                    flow.InvStateCode = InvState.InvEcecState_OutGoing.ToString();
+                    flow.EditTime = DateTime.Now;
+                    _billInvflow.Insert(flow);
+                }
+            }
+            catch (Exception ex)
+            {
+                _db.RollbackTran();
+                _logger.LogInformation("手动出库异常:" + ex.Message);
+                res.ResCode = ResponseStatusCodeEnum.DataSaveErr.GetHashCode();
+                res.ResMsg = ResponseStatusCodeEnum.DataSaveErr.GetDescription();
+                return res.ToCamelCaseString();
+            }
+            return res.ToCamelCaseString();
+        }
+
+        #region 完成/取消任务
+
+        /// <summary>
+        ///  完成任务
+        /// </summary>
+        /// <param name="reqDto"></param>
+        /// <returns></returns>
+        public SRes<int> CompleteTask(CompleteTaskRequest reqDto)
+        {
+            var result = new SRes<int>()
+            {
+                ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(),
+                ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription(),
+                ResData = reqDto.TaskNum
+            };
+
+            //检查历史任务表是否有任务
+            var task = _wcstaskoldrepository.AsQueryable().SplitTable(tabs => tabs.Take(3)).Where(p => p.ID == reqDto.TaskNum).First();
+            if (task == null)
+            {
+                result.ResCode = ResponseStatusCodeEnum.WcsTaskNotExist.GetHashCode();
+                result.ResMsg = reqDto.TaskNum + ResponseStatusCodeEnum.WcsTaskNotExist.GetDescription();
+                return result;
+            }
+
+            switch (task.Type)
+            {
+                case TaskType.SetPlate:
+                    break;
+
+                case TaskType.EnterDepot:
+
+                    try
+                    {
+                        //检擦库存信息是否正确
+                        var stock = _billInvnowrepository.GetFirst(p => p.ContGrpBarCode == task.BarCode && p.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
+                        if (stock == null)
+                        {
+                            result.ResCode = ResponseStatusCodeEnum.StockNotExist.GetHashCode();
+                            result.ResMsg = task.BarCode + "没有已组盘的信息";
+                            return result;
+                        }
+
+                        var warehouse = _basewarehouserepository.GetSingle(p => p.Code == task.WarehouseCode);
+                        _db.BeginTran();
+                        int row = int.Parse(task.AddrTo.Split('-')[0]);
+                        int col = int.Parse(task.AddrTo.Split('-')[1]);
+                        int layer = int.Parse(task.AddrTo.Split('-')[2]);
+
+                        //更新库存
+                        _billInvnowrepository.UpdateModelColumns(p => new BillInvnow()
+                        {
+                            InvStateCode = InvState.InvEcecState_In.ToString(),
+                            PutRow = row,
+                            PutCol = col,
+                            PutLayer = layer,
+                            OneInTime = DateTime.Now,
+                            EditTime = DateTime.Now
+                        }, p => p.ContGrpBarCode == task.BarCode && p.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
+
+                        //更新货位
+                        _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell()
+                        {
+                            StateNum = LocationState.LocationState_Full.GetHashCode(),
+                            ContGrpBarCode = stock.ContGrpBarCode,
+                            ContGrpId = stock.ContGrpId,
+                            EditTime = DateTime.Now
+                        }, p => p.Code.Contains(task.AddrTo));
+
+                        //增加流水信息
+                        var enterDepotstocklist = _billInvnowrepository.GetList(p => p.ContGrpBarCode == task.BarCode && p.InvStateCode == InvState.InvEcecState_In.ToString());
+                        foreach (var item in enterDepotstocklist)
+                        {
+                            item.Id = IdFactory.NewId();
+                            item.AddTime = DateTime.Now;
+                        }
+                        _billInvflow.InsertRange(_mapper.Map<List<BillInvflow>>(enterDepotstocklist));
+
+                        //TODO:暂未处理甲方管理系统相关内容
+                        //var list = new List<BillPushinfo>();
+                        //string pushtype = FackbeekType.InterfaceType_HJ_1F_StockIn.ToString();
+                        //if (stock.IsBack)
+                        //{
+                        //    pushtype = FackbeekType.InterfaceType_HJ_2F_BackStockIn.ToString();
+                        //}
+                        //else if (stock.IsSurplus)
+                        //{
+                        //    pushtype = FackbeekType.InterfaceType_HJ_2F_LeftStockIn.ToString();
+                        //}
+                        ////else if()
+                        ////回调数据
+                        //foreach (var item in stocklist)
+                        //{
+                        //    list.Add(new BillPushinfo
+                        //    {
+                        //        DocsNo = stock.ExecDocsNo,
+                        //        TypeCode = pushtype,
+                        //        RFIDBarCode = stock.ContGrpBarCode,
+                        //        HWBarCode = stock.ContGrpBarCode,
+                        //        CLBarCode = item.CLBarCode,
+                        //        WarehouseId = warehouse.Id,
+                        //        WarehouseCode = warehouse.Code,
+                        //        WareCellId = 0,
+                        //        WareCellCode = task.AddrTo,
+                        //        MatId = item.MatId,
+                        //        MatCode = item.MatCode,
+                        //        MatName = item.MatName,
+                        //        TolWQty = item.TolWQty,
+                        //        NetWQty = item.NetWQty,
+                        //        TareWQty = item.TareWQty,
+                        //        ReqNo = Guid.NewGuid().ToString()
+                        //    });
+                        //}
+                        //if (stock.ContGrpType == ContGrpType.Material.GetHashCode())
+                        //{
+                        //    _billPushinforepository.InsertRange(list);
+                        //}
+                        _db.CommitTran();
+                    }
+                    catch (Exception ex)
+                    {
+                        _db.RollbackTran();
+                        result.ResCode = ResponseStatusCodeEnum.InnerServerErr.GetHashCode();
+                        result.ResMsg = task.ID + "完成任务异常";
+                        _logger.LogInformation("完成任务异常" + ex.ToString());
+                    }
+
+                    break;
+
+                case TaskType.OutDepot:
+                    //验证库存信息
+                    var stocklist = _billInvnowrepository.GetList(p => p.ContGrpBarCode == task.BarCode && p.InvStateCode == InvState.InvEcecState_OutGoing.ToString());
+                    if (stocklist == null || !stocklist.Any())
+                    {
+                        result.ResCode = ResponseStatusCodeEnum.StockNotExist.GetHashCode();
+                        result.ResMsg = reqDto.TaskNum + ResponseStatusCodeEnum.StockNotExist.GetDescription();
+                        return result;
+                    }
+                    var flowlist = _mapper.Map<List<BillInvflow>>(stocklist);
+                    foreach (var item in flowlist)
+                    {
+                        item.Id = IdFactory.NewId();
+                        item.InvStateCode = InvState.InvEcecState_Out.ToString();
+                        item.AddTime = DateTime.Now;
+                        item.Memo = "任务完成";
+                    }
+                    try
+                    {
+                        _db.BeginTran();
+                        //删除库存及条码信息
+                        _billInvnowrepository.Delete(p => stocklist.Select(p => p.Id).ToList().Contains(p.Id));
+                        _billInvinitrepository.Delete(p => p.ContGrpBarCode == task.BarCode);
+                        //更新货位信息
+                        _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell()
+                        {
+                            StateNum = LocationState.LocationState_Empty.GetHashCode(),
+                            ContGrpBarCode = "",
+                            ContGrpId = 0,
+                            EditTime = DateTime.Now
+                        }, p => p.StateNum == LocationState.LocationState_StockOut.GetHashCode() && p.ContGrpId == flowlist.First().ContGrpId && p.Code.Contains(task.AddrFrom));
+
+                        //更新流水信息
+                        _billInvflow.InsertRange(flowlist);
+                        _db.CommitTran();
+                    }
+                    catch (Exception ex)
+                    {
+                        _db.RollbackTran();
+                        _logger.LogInformation(ex.ToString());
+                        result.ResCode = ResponseStatusCodeEnum.InnerServerErr.GetHashCode();
+                        result.ResMsg = task.ID + "完成任务异常";
+                    }
+                    break;
+
+                case TaskType.TransferDepot:
+
+                    var fromcell = _basewarecellrepository.GetFirst(p => p.Code == task.AddrFrom);
+                    var grcontid = fromcell.ContGrpId;
+                    var grcontcode = fromcell.ContGrpBarCode;
+                    var fromcellno = fromcell.Code;
+                    var tocellno = task.AddrTo;
+
+                    try
+                    {
+                        _db.BeginTran();
+                        //更新货位信息
+                        //起始货位
+                        _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell()
+                        {
+                            StateNum = LocationState.LocationState_Empty.GetHashCode(),
+                            ContGrpBarCode = "",
+                            ContGrpId = 0,
+                            EditTime = DateTime.Now
+                        }, p => p.Code.Contains(fromcellno));
+                        //目标货位
+                        _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell()
+                        {
+                            StateNum = LocationState.LocationState_Full.GetHashCode(),
+                            ContGrpBarCode = grcontcode,
+                            ContGrpId = grcontid,
+                            EditTime = DateTime.Now
+                        }, p => p.Code.Contains(tocellno));
+
+                        //更新库存信息
+                        int row = int.Parse(tocellno.Split('-')[0]);
+                        int col = int.Parse(tocellno.Split('-')[1]);
+                        int layer = int.Parse(tocellno.Split('-')[2]);
+                        _billInvnowrepository.UpdateModelColumns(p => new BillInvnow()
+                        {
+                            PutRow = row,
+                            PutCol = col,
+                            PutLayer = layer
+                        }, p => p.ContGrpId == grcontid && p.InvStateCode == InvState.InvEcecState_In.ToString());
+
+                        //更新流水信息
+                        var stock = _billInvnowrepository.GetFirst(p => p.ContGrpId == grcontid && p.ContGrpBarCode == grcontcode && p.InvStateCode == InvState.InvEcecState_In.ToString());
+                        var flow = _mapper.Map<BillInvflow>(stock);
+                        flow.Id = IdFactory.NewId();
+                        flow.AddTime = DateTime.Now;
+                        flow.Memo = grcontcode + "移库(" + fromcellno + "至" + tocellno + ")";
+                        _billInvflow.Insert(flow);
+                        _db.CommitTran();
+                    }
+                    catch (Exception ex)
+                    {
+                        _db.RollbackTran();
+                        result.ResCode = ResponseStatusCodeEnum.InnerServerErr.GetHashCode();
+                        result.ResMsg = task.ID + "完成任务异常";
+                        _logger.LogInformation("完成任务异常" + ex.ToString());
+                    }
+                    break;
+
+                case TaskType.Delivery:
+                    break;
+
+                case TaskType.EmptyInit:
+                    break;
+
+                default:
+                    result.ResCode = ResponseStatusCodeEnum.Fail.GetHashCode();
+                    result.ResMsg = reqDto.TaskNum + ResponseStatusCodeEnum.Fail.GetDescription();
+                    return result;
+            }
+
+            return result;
+        }
+
+        #endregion 完成/取消任务
     }
 }

+ 16 - 8
wms.service/mapper/WmsPrifile.cs

@@ -1,18 +1,15 @@
 using AutoMapper;
 using System;
-using System.Collections.Generic;
-using System.Text;
 using WCS.Entity;
 using wms.dto.request;
+using wms.dto.request.fj;
 using wms.dto.request.hj;
 using wms.dto.request.hj.dto;
 using wms.dto.request.pt;
 using wms.dto.request.share;
 using wms.dto.response;
 using wms.dto.response.fj;
-using wms.dto.response.hj;
 using wms.dto.response.pt.dto;
-using wms.sqlsugar.model;
 using wms.sqlsugar.model.hj;
 using wms.sqlsugar.model.pt;
 using static wms.dto.request.hj.dto.ReportResponse;
@@ -44,12 +41,23 @@ namespace wms.service.mapper
             CreateMap<BillInvnow, BillInvflow>();
             CreateMap<BillInvflow, BillInvnow>();
             CreateMap<WCS_TaskInfo, WCS_TaskOld>();
- 
+
             CreateMap<CopperLineRequest, HjMaterialStockInRequest>();
+
             CreateMap<WetLineBackInApplyRequest, HjMaterialStockInRequest>();
             CreateMap<SysJob, dto.response.hj.SysJobDto>();
 
-            
+            #region 分拣
+
+            CreateMap<FJBuildEmptyPalletsStockRequest, FJBuildEmptyPalletsStockDto>();
+            CreateMap<SRes, CopperLineResponse>();
+            CreateMap<sqlsugar.model.fj.BillInvinit, sqlsugar.model.fj.BillInvnow>();
+            CreateMap<sqlsugar.model.fj.BillInvnow, sqlsugar.model.fj.BillInvflow>();
+            CreateMap<sqlsugar.model.fj.BillInvflow, sqlsugar.model.fj.BillInvnow>();
+            CreateMap<WCS.Entity.fj.WCS_TaskInfo, WCS.Entity.fj.WCS_TaskOld>();
+            CreateMap<sqlsugar.model.fj.BillInvflow, sqlsugar.model.fj.BillInvnow>();
+
+            #endregion 分拣
 
             CreateMap<BillPushinfo, ListInfo>()
                 .ForMember(p => p.RFID, opt => opt.MapFrom(src => src.RFIDBarCode))
@@ -95,7 +103,6 @@ namespace wms.service.mapper
                 .ForMember(p => p.WeightUnit, opt => opt.MapFrom(src => src.WeightUnit))
                 ;
 
-
             CreateMap<UpdateMaterEntity, UpdateMaterEntity>();
             //任务
             CreateMap<hjBillTask, TaskRsponse>();
@@ -112,6 +119,7 @@ namespace wms.service.mapper
             CreateMap<MaterInfo, MaterInfo>();
 
             #region 盘条库映射
+
             CreateMap<ptWCS_TaskInfo, PtTaskRsponse>();
             CreateMap<PtTaskRsponse, ptWCS_TaskInfo>();
             CreateMap<ptWCS_TaskInfo, ptWCS_TaskInfo>();
@@ -159,8 +167,8 @@ namespace wms.service.mapper
                 .ForMember(p => p.LocCode, opt => opt.MapFrom(src => src.WareCellCode))
                 .ForMember(p => p.WareCode, opt => opt.MapFrom(src => src.WarehouseCode))
                 .ForMember(p => p.WareName, opt => opt.MapFrom(src => "盘条库"));
-            #endregion
 
+            #endregion 盘条库映射
         }
     }
 }

+ 64 - 64
wms.sqlsugar/model/fj/BillInvnow.cs

@@ -11,7 +11,7 @@ namespace wms.sqlsugar.model.fj
     public partial class BillInvnow : BaseModel
     {
         /// <summary>
-        ///  仓库ID
+        ///  仓库ID 关联仓库表 ID
         /// </summary>
         [SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
         public long WarehouseId { get; set; }
@@ -24,7 +24,7 @@ namespace wms.sqlsugar.model.fj
         public long ContGrpId { get; set; }
 
         /// <summary>
-        ///  组盘条码
+        ///  容器条码 同联容器表容器条码 ContBarCode
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ContGrpBarCode { get; set; }
@@ -36,97 +36,97 @@ namespace wms.sqlsugar.model.fj
         public int ContGrpType { get; set; }
 
         /// <summary>
-        /// BoxBarCode
+        ///  箱条码
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BoxBarCode { get; set; }
 
         /// <summary>
-        /// BomDocsNo
+        ///  Bom单号 关联投料单 帘线工序工单号 BillCode
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BomDocsNo { get; set; }
 
         /// <summary>
-        /// BomMatId
+        ///  Bom物料ID
         /// </summary>
         [SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
         public long BomMatId { get; set; }
 
         /// <summary>
-        /// BomMatCode
+        ///  Bom物料编号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BomMatCode { get; set; }
 
         /// <summary>
-        /// BomMatName
+        ///  Bom物料
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
         public string BomMatName { get; set; }
 
         /// <summary>
-        /// BomSetId
+        ///  垛形主表 ID
         /// </summary>
         [SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
         public long BomSetId { get; set; }
 
         /// <summary>
-        /// ExecStateCode
+        ///  库存状态码
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecStateCode { get; set; }
 
         /// <summary>
-        /// ExecDocsNo
+        /// 单据编号 关联单据表单据编号 DocsNo
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecDocsNo { get; set; }
 
         /// <summary>
-        /// ExecDocsRowNo
+        ///  单据行号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecDocsRowNo { get; set; }
 
         /// <summary>
-        /// ExecDocsTypeCode
+        ///  单据类型编号 同单据表TypeNum
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecDocsTypeCode { get; set; }
 
         /// <summary>
-        /// InvInOut
+        ///  出入库标识 默认0 出库1 入库2
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int InvInOut { get; set; }
 
         /// <summary>
-        /// ExecWho
+        ///  执行人
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecWho { get; set; }
 
         /// <summary>
-        /// ExecTime
+        ///  执行时间
         /// </summary>
         [SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
         public DateTime ExecTime { get; set; }
 
         /// <summary>
-        /// PutRow
+        /// 
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int PutRow { get; set; }
 
         /// <summary>
-        /// PutCol
+        /// 
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int PutCol { get; set; }
 
         /// <summary>
-        /// PutLayer
+        /// 
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int PutLayer { get; set; }
@@ -156,277 +156,277 @@ namespace wms.sqlsugar.model.fj
         public string InDocsRowNo { get; set; }
 
         /// <summary>
-        /// SuppCode
+        ///  供应编号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string SuppCode { get; set; }
 
         /// <summary>
-        /// SuppName
+        ///  供应商名称
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string SuppName { get; set; }
 
         /// <summary>
-        /// CustCode
+        ///  海关编号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string CustCode { get; set; }
 
         /// <summary>
-        /// CustName
+        ///  海关名称
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string CustName { get; set; }
 
         /// <summary>
-        /// MatId
+        ///  物料ID
         /// </summary>
         [SugarColumn(ColumnDataType = "bigint", IsNullable = false)]
         public long MatId { get; set; }
 
         /// <summary>
-        /// MatCode
+        ///  物料编号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string MatCode { get; set; }
 
         /// <summary>
-        /// MatName
+        ///  物料名称
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 100, IsNullable = true)]
         public string MatName { get; set; }
 
         /// <summary>
-        /// TolWQty
+        ///  总重量
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal TolWQty { get; set; }
 
         /// <summary>
-        /// NetWQty
+        ///  净重
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal NetWQty { get; set; }
 
         /// <summary>
-        /// TareWQty
+        ///  皮重
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal TareWQty { get; set; }
 
         /// <summary>
-        /// LengthQty
+        ///  总长
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal LengthQty { get; set; }
 
         /// <summary>
-        /// CaQty
+        ///  碳当量
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal CaQty { get; set; }
 
         /// <summary>
-        /// SolderQty
+        ///  销售总量
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = false)]
         public decimal SolderQty { get; set; }
 
         /// <summary>
-        /// ContUsageQty
+        ///  暂定
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int ContUsageQty { get; set; }
 
         /// <summary>
-        /// BatchNo
+        ///  批次号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BatchNo { get; set; }
 
         /// <summary>
-        /// ProductTime
+        ///  生产时间
         /// </summary>
         [SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
         public DateTime ProductTime { get; set; }
 
         /// <summary>
-        /// OneInTime
+        ///  第一次入库时间
         /// </summary>
         [SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
         public DateTime OneInTime { get; set; }
 
         /// <summary>
-        /// RodBarCode
+        ///  盘条条码
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string RodBarCode { get; set; }
 
         /// <summary>
-        /// HWBarCode
+        ///  工字轮条码
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string HWBarCode { get; set; }
 
         /// <summary>
-        /// RFIDBarCode
+        ///  RFID条码
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string RFIDBarCode { get; set; }
 
         /// <summary>
-        /// CLBarCode
+        ///  材料号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string CLBarCode { get; set; }
 
         /// <summary>
-        /// HWTypeCode
+        ///  工字轮条码类型
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string HWTypeCode { get; set; }
 
         /// <summary>
-        /// BoilerNo
+        ///  炉号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BoilerNo { get; set; }
 
         /// <summary>
-        /// PackNo
+        ///  包号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string PackNo { get; set; }
 
         /// <summary>
-        /// BrandNo
+        ///  牌号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string BrandNo { get; set; }
 
         /// <summary>
-        /// ExecStd
+        ///  执行标准
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ExecStd { get; set; }
 
         /// <summary>
-        /// LicenceCode
+        ///  许可证号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string LicenceCode { get; set; }
 
         /// <summary>
-        /// IsSurplus
+        ///  改手盘标记
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsSurplus { get; set; }
 
         /// <summary>
-        /// IsRework
+        ///  返工标记
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsRework { get; set; }
 
         /// <summary>
-        /// IsBlack
+        ///  是否黑盘
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsBlack { get; set; }
 
         /// <summary>
-        /// IsCore
+        ///  是否芯股
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsCore { get; set; }
 
         /// <summary>
-        /// IsFast
+        ///  快投标记
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsFast { get; set; }
 
         /// <summary>
-        /// IsFail
+        ///  是否异常
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsFail { get; set; }
 
         /// <summary>
-        /// FailReason
+        ///  异常原因
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
         public string FailReason { get; set; }
 
         /// <summary>
-        /// SilkTypeCode
+        ///  单/双丝
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string SilkTypeCode { get; set; }
 
         /// <summary>
-        /// Grade
+        ///  等级
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string Grade { get; set; }
 
         /// <summary>
-        /// IsBack
+        ///  是否退料
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsBack { get; set; }
 
         /// <summary>
-        /// BackReason
+        ///  退料原因
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 200, IsNullable = true)]
         public string BackReason { get; set; }
 
         /// <summary>
-        /// IsTorsChk
+        ///  是否扭转检测
         /// </summary>
         [SugarColumn(ColumnDataType = "bit", IsNullable = false)]
         public bool IsTorsChk { get; set; }
 
         /// <summary>
-        /// TorsChkQty
+        ///  扭转次数
         /// </summary>
         [SugarColumn(ColumnDataType = "int", IsNullable = false)]
         public int TorsChkQty { get; set; }
 
         /// <summary>
-        /// TorsChkTime
+        ///  扭转检测时间
         /// </summary>
         [SugarColumn(ColumnDataType = "datetime", IsNullable = false)]
         public DateTime TorsChkTime { get; set; }
 
         /// <summary>
-        /// TorsChkValue
+        ///  扭转检测结果值
         /// </summary>
         [SugarColumn(ColumnDataType = "decimal", Length = 18, IsNullable = true)]
         public decimal? TorsChkValue { get; set; }
 
         /// <summary>
-        /// TorsChkMachCode
+        ///  扭转检测设备号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string TorsChkMachCode { get; set; }
 
         /// <summary>
-        /// 单号
+        ///  工序订单号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ProcessDocsCode { get; set; }
 
         /// <summary>
-        ///  成品机台号
+        ///  生产机台号
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ProductMachCode { get; set; }
 
         /// <summary>
-        ///  分拣机台
+        ///  生成产线
         /// </summary>
         [SugarColumn(ColumnDataType = "nvarchar", Length = 50, IsNullable = true)]
         public string ProductLineNo { get; set; }

+ 1 - 0
wms.sqlsugar/model/fj/WCS_AgvTaskInfo.cs

@@ -8,6 +8,7 @@ namespace WCS.Entity.fj
     /// <summary>
     /// AGV任务中间表
     /// </summary>
+    [Tenant("fj")]
     [SugarTable(nameof(WCS_AgvTaskInfo) + "_{year}{month}{day}", "AGV任务中间表")]
     [SplitTable(SplitType.Week)]//按年分表 (自带分表支持 年、季、月、周、日)
     [DataContract]

+ 1 - 1
wms.sqlsugar/model/fj/WCS_TaskDtl.cs

@@ -9,7 +9,7 @@ namespace WCS.Entity.fj
     /// <summary>
     /// 任务流转表
     /// </summary>
-    [Tenant("hj")]
+    [Tenant("fj")]
     [SugarTable(nameof(WCS_TaskDtl) + "_{year}{month}{day}", "任务流转表")]
     [SplitTable(SplitType.Month)]//按年分表 (自带分表支持 年、季、月、周、日)
     public class WCS_TaskDtl: BaseModel1

+ 1 - 1
wms.sqlsugar/model/fj/WCS_TaskInfo.cs

@@ -9,7 +9,7 @@ namespace WCS.Entity.fj
     /// <summary>
     /// 任务表
     /// </summary>
-    [Tenant("hj")]
+    [Tenant("fj")]
     [SugarTable(nameof(WCS_TaskInfo), "任务表")]
     public class WCS_TaskInfo
     {

+ 1 - 1
wms.sqlsugar/model/fj/WCS_TaskOld.cs

@@ -7,7 +7,7 @@ namespace WCS.Entity.fj
     /// <summary>
     /// 任务表
     /// </summary>
-    [Tenant("hj")]
+    [Tenant("fj")]
     [SugarTable(nameof(WCS_TaskOld) + "_{year}{month}{day}", "任务表")]
     [SplitTable(SplitType.Month)]//按年分表 (自带分表支持 年、季、月、周、日)
     public class WCS_TaskOld