wangxinhui
2025-03-01 056326f91432db1b2ede9d821d0a463682ffd2aa
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -24,10 +24,8 @@
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Model.Models.Outbound;
using System.Diagnostics.Metrics;
using System.Reflection.Metadata;
using WIDESEA_Model.Models.Inbound;
using WIDESEA_DTO.Task;
namespace WIDESEA_TaskInfoService
@@ -467,7 +465,7 @@
                    OutboundQuantity = 0,
                    SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0",
                    StockQuantity = model.Quantity,
                    Status = StockStatusEmun.MES退库.ObjToInt(),
                    Status = model.Quantity <= 0.0 ? StockStatusEmun.MES空托退库.ObjToInt() : StockStatusEmun.MES退库.ObjToInt(),
                    Unit = model.Unit
                };
                Dt_StockInfo stockInfo = new Dt_StockInfo()
@@ -475,8 +473,9 @@
                    PalletCode = model.CarrierCode,
                    PalletType = palletTypeInfo.PalletType,
                    WarehouseId = warehouse.WarehouseId,
                    StockStatus = StockStatusEmun.MES退库.ObjToInt(),
                    Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
                    StockStatus = stockInfoDetail.StockQuantity<=0.0? StockStatusEmun.MES空托退库.ObjToInt():StockStatusEmun.MES退库.ObjToInt(),
                    Details = new List<Dt_StockInfoDetail> { stockInfoDetail },
                    Remark= stockInfoDetail.StockQuantity <= 0.0 ? StockStatusEmun.MES空托退库.ToString() : StockStatusEmun.MES退库.ToString()
                };
                //Dt_Task task = new Dt_Task()
                //{
@@ -911,7 +910,6 @@
                    content.BSucc = true;
                    content.StrCode = "0000";
                    content.StrMsg = "执行成功";
                    content.DataTime = DateTime.Now;
                    content.MaterialCode = stock.MaterielCode;
                    content.Quantity = stock.StockQuantity;
                    content.Unit = stock.Unit;
@@ -928,6 +926,46 @@
                return MesResponseContent.Instance.Error(ex.Message);
            }
        }
        /// <summary>
        /// MES成品入库单接收
        /// </summary>
        /// <returns></returns>
        public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel)
        {
            MesResponseContent content = new MesResponseContent();
            try
            {
                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==bagInfoModel.WarehouseCode);
                if (warehouse==null)
                {
                    return content.Error("未找到仓库信息");
                }
                List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>();
                foreach (var item in bagInfoModel.BagDetails)
                {
                    mesProInOrderDetails.Add(_mapper.Map<Dt_MesProInOrderDetail>(item));
                }
                mesProInOrderDetails.ForEach(x =>
                {
                    x.OverInQuantity = 0;
                });
                Dt_MesProInOrder mesProInOrder = new Dt_MesProInOrder()
                {
                    WarehouseId = warehouse.WarehouseId,
                    BatchNo = bagInfoModel.BatchNo,
                    MesProStatus = InOrderStatusEnum.未开始.ObjToInt(),
                    UnPackStock=bagInfoModel.UnPackStock,
                    Details= mesProInOrderDetails
                };
                Db.InsertNav(mesProInOrder).Include(x=>x.Details).ExecuteCommand();
                return content.OK("接收成功");
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}