chengsc
2024-11-13 515978fab272cec55342103182af68c1dcddbfea
Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -49,11 +49,11 @@
                {
                    throw new Exception("单据类型不可为空!");
                }
                if (string.IsNullOrEmpty(model.Customer))
                {
                    throw new Exception("客户不可为空!");
                }
                if (string.IsNullOrEmpty(model.OrderCode))
                //if (string.IsNullOrEmpty(model.Customer))
                //{
                //    throw new Exception("客户不可为空!");
                //}
                if (string.IsNullOrEmpty(model.OrderNo))
                {
                    throw new Exception("系统单号不可为空!");
                }
@@ -68,10 +68,10 @@
                //客户信息
                var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.Customer);
                if (customer == null)
                {
                    throw new Exception("客户不可为空!");
                }
                //if (customer == null)
                //{
                //    throw new Exception("客户不可为空!");
                //}
                var logistics = Db.Queryable<SysLogisticsInfo>().First(m => m.IsDel == "0" && m.CarrierName == model.LogisticsNo);
                int? logisticsId = null;
                if (logistics != null)
@@ -127,8 +127,9 @@
                            }
                            if (qty > d.Qty - q1)
                            {
                                q1 += d.Qty - q1;
                                dic.Add(stocks.First().Id, d.Qty - q1);
                                q1 += d.Qty - q1;
                            }
                            else
                            {
@@ -149,10 +150,11 @@
                                }
                                var q2 = demo.Qty - demo.LockQty - demo.FrozenQty;
                                if (q2 > d.Qty - q1)
                                if (q2 >= d.Qty - q1)
                                {
                                    q1 += d.Qty - q1;
                                    dic.Add(demo.Id, d.Qty - q1);
                                    q1 += d.Qty - q1;
                                }
                                else
                                {
@@ -161,7 +163,7 @@
                                }
                            }
                            if (d.Qty >= q1)
                            if (d.Qty > q1)
                            {
                                stocks = stockList.Where(s => s.SkuNo == d.SkuNo && string.IsNullOrWhiteSpace(s.LotNo)).ToList();
                                if (stocks.Count == 0)
@@ -169,10 +171,11 @@
                                    throw new Exception($"总库存中出库物料信息:{d.SkuNo}库存数量不足");
                                }
                                var q2 = stocks.First().Qty - stocks.First().LockQty - stocks.First().FrozenQty;
                                if (q2 > d.Qty - q1)
                                if (q2 >= d.Qty - q1)
                                {
                                    q1 += d.Qty - q1;
                                    dic.Add(stocks.First().Id, d.Qty - q1);
                                    q1 += d.Qty - q1;
                                }
                                else
                                {
@@ -227,8 +230,8 @@
                        Type = model.SoType,
                        Status = "0",
                        Origin = model.Origin,
                        CustomerNo = model.Customer,
                        CustomerName = customer.CustomerName,
                        //CustomerNo = model.Customer,
                        //CustomerName = customer.CustomerName,
                        LogisticsId = logisticsId,
                        IsWave = "0",
                        WaveNo = "",
@@ -309,7 +312,7 @@
                }
                var soInfo = new SoInfo()
                {
                    OrderCode = notice.OrderCode,
                    OrderNo = notice.OrderCode,
                    SoDetails = list
                };
                #region 通过接口发送至erp