Administrator
2024-07-03 ea4fe1a6d1decf926292d3d71e7656bbcff4c937
Wms/WMS.BLL/BllTransServer/NoticeServer.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Utility.Tools;
using WMS.BLL.LogServer;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
@@ -15,6 +16,7 @@
using WMS.Entity.LogEntity;
using WMS.Entity.SysEntity;
using WMS.IBLL.IBllTransServer;
using static Model.InterFaceModel.RCSModel;
namespace WMS.BLL.BllTransServer
{
@@ -163,6 +165,10 @@
                    resultModel.Success = 0;
                    resultModel.Message = "成功";
                    //提交事务
                    Db.CommitTran();
                    return resultModel;
                }
                switch (taskInfo.OrderType)
@@ -486,28 +492,28 @@
                            sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//所属巷道
                            sd3.AreaNo = endLocatInfo2.AreaNo;//所属区域
                            sd3.LocatNo = endLocatInfo2.LocatNo;//储位地址
                            if (endLocatInfo2.AreaNo == "A01")//洁净区
                            if (endLocatInfo2.AreaNo.Contains("01"))//洁净区
                            {
                                sd3.PalletStatus = "0";
                                sd3.PalletStatus = "0";
                            }
                            else if (endLocatInfo2.AreaNo == "A02")//预混区
                            else if (endLocatInfo2.AreaNo.Contains("02"))//预混区
                            {
                                sd3.PalletStatus = "1";
                            }
                            else if (endLocatInfo2.AreaNo == "A03")//半成品区
                            else if (endLocatInfo2.AreaNo.Contains("03"))//半成品区
                            {
                                sd3.PalletStatus = "2";
                            }
                            else if (endLocatInfo2.AreaNo == "A04")//脏桶区
                            else if (endLocatInfo2.AreaNo.Contains("04"))//脏桶区
                            {
                                sd3.PalletStatus = "3";
                                sd3.LotNo = "";//批次
                                sd3.SkuNo = "";
                                sd3.SkuName = "";
                                sd3.InspectStatus = "0";//待检验
                            }
                            }
                        }
                        if (taskInfo.Type == "1")//出库任务
                        else if (taskInfo.Type == "1")//出库任务
                        {
                            //起始储位信息
                            var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
@@ -525,8 +531,62 @@
                            sd3.AreaNo = "";//所属区域
                            sd3.LocatNo = "";//储位地址
                        }
                        else if (taskInfo.Type == "2")//移库任务
                        {
                            //起始储位信息
                            var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
                            if (startLocatInfo2 == null)
                            {
                                resultModel.Message = "起始储位信息不存在!";
                                return resultModel;
                            }
                            startLocatInfo2.Status = "0";//空储位
                            //修改起始储位状态
                            Db.Updateable(startLocatInfo2).ExecuteCommand();
                            //目标储位信息
                            var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
                            if (endLocatInfo2 == null)
                            {
                                resultModel.Message = "目标储位信息不存在!";
                                return resultModel;
                            }
                            endLocatInfo2.Status = "1";//有物品
                            //修改目标储位状态
                            Db.Updateable(endLocatInfo2).ExecuteCommand();
                            sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//所属仓库
                            sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//所属巷道
                            sd3.AreaNo = endLocatInfo2.AreaNo;//所属区域
                            sd3.LocatNo = endLocatInfo2.LocatNo;//储位地址
                            sd3.Status = "0";
                            if (endLocatInfo2.AreaNo.Contains("01"))//洁净区
                            {
                                sd3.PalletStatus = "0";
                                sd3.Status = "0";
                            }
                            else if (endLocatInfo2.AreaNo.Contains("02"))//预混区
                            {
                                sd3.PalletStatus = "1";
                            }
                            else if (endLocatInfo2.AreaNo.Contains("03"))//半成品区
                            {
                                sd3.PalletStatus = "2";
                            }
                            else if (endLocatInfo2.AreaNo.Contains("04"))//脏桶区
                            {
                                sd3.PalletStatus = "3";
                                sd3.LotNo = "";//批次
                                sd3.SkuNo = "";
                                sd3.SkuName = "";
                                sd3.InspectStatus = "0";//待检验
                            }
                        }
                        //修改库存明细
                        Db.Updateable(sd3).ExecuteCommand();
                        //回传桶状态给MES
                        BackPalletStatus(taskInfo.PalletNo, sd3.PalletStatus);
                        break;    
                    #endregion
@@ -551,6 +611,31 @@
        }
        /// <summary>
        /// 回传桶状态给MES
        /// </summary>
        /// <param name="PalletNo">桶号</param>
        /// <param name="Status">0:净桶 1:预混 2:半成品 3:脏桶</param>
        /// <param name="url"></param>
        public void BackPalletStatus(string PalletNo, string Status,string url="")
        {
            try
            {
                var obj = new
                {
                    PalletNo = PalletNo,
                    Status = Status
                };
                string jsonReq = JsonConvert.SerializeObject(obj);
                var response = HttpHelper.DoPost(url, jsonReq, "回传MES桶状态", "MES").ToString();
                var result = JsonConvert.DeserializeObject<ReMes>(response);//解析返回数据
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 下发出库单
        /// </summary>
        /// <param name="model"></param>