dengjunjie
2024-11-27 5be0f5bc3b9a83a3b30c9915bd5309279d140244
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -1,4 +1,5 @@
using AutoMapper;
using Microsoft.IdentityModel.Tokens;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -72,14 +73,28 @@
                if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
                #endregion
                List<string> LocationCodes = orderAddDTO.Details
                    .Where(x => !string.IsNullOrEmpty(x.LocationCode))
                    .Select(x => x.LocationCode).ToList();
                Dt_InboundOrder inboundOrder = _mapper.Map<Dt_InboundOrder>(orderAddDTO);
                inboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss");
                //inboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss");
                inboundOrder.OrderStatus = InboundStatusEnum.未开始.ObjToInt();
                bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                Db.Ado.BeginTran();
                if (LocationCodes.Any())
                {
                    content = _basicService.LocationInfoService.UpdateStatus(LocationCodes, LocationStatusEnum.PalletLock.ObjToInt());
                    if (!content.Status)
                        throw new Exception(content.Message);
                }
                BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
                Db.Ado.CommitTran();
                content = WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                content = WebResponseContent.Instance.Error(ex.Message);
            }
            finally