1
huanghongfeng
2024-11-27 1dd9f4bf540a74a7de2daeeebf38491f86befa08
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -49,6 +49,7 @@
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_TaskInfoRepository;
using static WIDESEA_ITaskInfoService.ITaskService;
namespace WIDESEA_TaskInfoService
{
@@ -125,35 +126,34 @@
            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
            //查货位
            Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
            Dt_StockInfoDetail dt_StockInfodetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.OrderNo == task.PalletCode);
            CheckCompleted(stockInfo, locationInfo);
            if (stockInfo.MaterialType == (int)InventoryMaterialType.空托)
            {
                string currentTime = DateTime.Now.ToString("HHmmss");
                stockInfo.PalletCode = "KTP" + currentTime;
            }
            stockInfo.LocationCode = task.TargetAddress;
            stockInfo.StockStatus = StockStatusEmun.已入库.ObjToInt();
             _stockService.StockInfoService.Repository.UpdateData(stockInfo);
            if (_stockService.StockInfoService.Repository.UpdateData(stockInfo))
            {
                string[] Pallet = stockInfo.PalletCode.Split("-");
                Dt_StockInfoDetail dt_StockInfoDetail = new()
                {
                    StockId = stockInfo.Id,
                    MaterielCode = Pallet[0],    //物料编号
                    MaterielName = Pallet[1],    //材质
                    OrderNo = stockInfo.PalletCode,        //单据(托盘条码)
                    BatchNo = Pallet[2],         //批次号
                    SerialNumber = Pallet[2],    //序列号
                    StockQuantity = decimal.Parse(Pallet[3]),    //序列号
                    OutboundQuantity = decimal.Parse(Pallet[3]),    //序列号
                    Status = (int)StockStatusEmun.已入库,
                    Creater = "WMS",
                    CreateDate = DateTime.Now,
                };
                _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail);
            }
            if(dt_StockInfodetail != null)
            {
                dt_StockInfodetail.Status = StockStatusEmun.已入库.ObjToInt();
                _stockService.StockInfoDetailService.Repository.UpdateData(dt_StockInfodetail);
            }
            beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity);
            int beforeStatus = locationInfo.LocationStatus;
            locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
            if (stockInfo.MaterialType == (int)InventoryMaterialType.空托)
            {
                locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
            }
            else
            {
                locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
            }
            _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
            _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
@@ -297,12 +297,12 @@
            return WebResponseContent.Instance.OK();
        }
        public WebResponseContent RelocationTaskCompleted(string PalletCode,string SourceAddress, string TargetAddress)
        public WebResponseContent RelocationTaskCompleted(GenerateInv2 generate)
        {
            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(PalletCode);
            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(generate.PalletCode);
            Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == SourceAddress);
            Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == TargetAddress);
            Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == generate.SourceAddress);
            Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == generate.TargetAddress);
            List<Dt_LocationInfo> loca = new List<Dt_LocationInfo>();
            stockInfo.LocationCode = locationEnd.LocationCode;