| | |
| | | //获取库存 |
| | | var stockList = Db.Queryable<DataStock>().Where(s => skuNos.Contains(s.SkuNo) && (s.Qty - s.FrozenQty - s.LockQty) > 0).ToList(); |
| | | |
| | | //string CustomerName = string.Empty; |
| | | //if (!string.IsNullOrEmpty(model.customerNo)) |
| | | //{ |
| | | // //客户信息 |
| | | // var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.customerNo); |
| | | // if (customer == null) |
| | | // { |
| | | // throw new Exception("客户信息不存在!"); |
| | | // } |
| | | // CustomerName = customer.CustomerName; |
| | | //} |
| | | string CustomerName = string.Empty; |
| | | if (!string.IsNullOrEmpty(model.customerNo)) |
| | | { |
| | | //客户信息 |
| | | var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.customerNo); |
| | | if (customer != null) |
| | | if (customer == null) |
| | | { |
| | | throw new Exception("客户信息不存在!"); |
| | | } |
| | | CustomerName = customer.CustomerName; |
| | | } |
| | | else |
| | | { |
| | | // 记录日志,便于排查 |
| | | Console.WriteLine($"警告:客户信息不存在,customerNo={model.customerNo}"); |
| | | // 可设置默认客户名称或其他处理,根据业务决定 |
| | | CustomerName = "默认客户"; |
| | | } |
| | | } |
| | | |
| | | //承运商信息 |
| | | //var logistics = Db.Queryable<SysLogisticsInfo>().First(m => m.IsDel == "0" && m.CarrierName == model.LogisticsNo); |
| | | //int? logisticsId = null; |
| | |
| | | try |
| | | { |
| | | var list = new List<BllExportNoticeDetail>(); |
| | | var houseNo = string.Empty; |
| | | //添加出库单 |
| | | foreach (var d in model.orderDetailList) |
| | | { |
| | | if (!string.IsNullOrEmpty(houseNo)) |
| | | { |
| | | if (houseNo != d.wareHouseNo) |
| | | { |
| | | throw new Exception("同个出库单下明细列表发出仓库不一致!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | houseNo = d.wareHouseNo; |
| | | } |
| | | if (d.skuQty < 1) |
| | | { |
| | | throw new Exception("出库数量必须大于0"); |
| | |
| | | OrderCode=model.orderNo, |
| | | Type = model.orderType, |
| | | Status = "0", |
| | | Origin = "WMS", |
| | | Origin = "SAP", |
| | | CustomerNo = model.customerNo, |
| | | CustomerName = CustomerName, |
| | | LogisticsId = null,//logisticsId, |
| | |
| | | |
| | | CreateUser = 0, |
| | | }; |
| | | if (houseNo == "1000" || houseNo == "1001" || houseNo == "2000") |
| | | { |
| | | notice.WareHouseNo = "W01"; |
| | | } |
| | | else if (houseNo == "2001") |
| | | { |
| | | notice.WareHouseNo = "W02"; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("发出仓库异常"); |
| | | } |
| | | |
| | | |
| | | var n = Db.Insertable<BllExportNotice>(notice).ExecuteCommand(); |
| | | var m = Db.Insertable<BllExportNoticeDetail>(list).ExecuteCommand(); |