| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Utility.Tools; |
| | | using WMS.BLL.Logic; |
| | | using WMS.BLL.LogServer; |
| | |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// PDA平库下发出库 |
| | | /// </summary> |
| | | /// <param name="soNo"></param> |
| | | /// <param name="detailId"></param> |
| | | /// <param name="palletNo"></param> |
| | | /// <param name="userId"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public void IssueOutHousePk(string soNo, string detailId, string palletNo, int userId) |
| | | { |
| | | try |
| | | { |
| | | var notice = Db.Queryable<BllExportNotice>().First(m => m.SONo == soNo && m.IsDel == "0"); |
| | | if (notice == null) |
| | | { |
| | | throw new Exception($"未找到{soNo}出库单信息"); |
| | | } |
| | | var detail=Db.Queryable<DataStockDetail>().First(m => m.PalletNo == palletNo && m.IsDel == "0"); |
| | | if (detail.WareHouseNo != "W04") |
| | | { |
| | | throw new Exception("仓库号错误"); |
| | | } |
| | | var intDetailId = int.Parse(detailId); |
| | | if (intDetailId <= 0) |
| | | { |
| | | throw new Exception("选择的出库单明细参数错误"); |
| | | } |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | | notice.Status = "3";//正在进行 |
| | | Db.Updateable(notice).ExecuteCommand(); |
| | | |
| | | //所有要出库的出库分配信息(未下发的信息和待拣货的信息) |
| | | var allot = Db.Queryable<BllExportAllot>().Where(a => a.IsDel == "0" && a.PalletNo == palletNo && a.Status == "0").ToList(); |
| | | if (allot == null || allot.Count <= 0) //判断是否有需要下发的出库流水 |
| | | { |
| | | throw new Exception("当前出库单据无需要下发的托盘"); |
| | | } |
| | | //出库流水(更改状态) |
| | | foreach (var item in allot) |
| | | { |
| | | item.Status = "2"; |
| | | Db.Updateable(item).ExecuteCommand(); |
| | | } |
| | | |
| | | //添加操作日志记录 |
| | | var k = new OperationSOServer().AddLogOperationSo("PDA模块", "下发出库", soNo, "出库", $"点击出库按钮出库单号为:{soNo}的出库单", userId); |
| | | //提交事务 |
| | | Db.CommitTran(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | //回滚事务 |
| | | Db.RollbackTran(); |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | #region MyRegion |
| | | |