public string DeleteBillData(string orderNo) { var bill = GetWmsOrderOut(orderNo); var serviceHeader = TableViewServiceFactory.CreateInstance <IWbsOrderService>(); var serviceLine = TableViewServiceFactory.CreateInstance <IWbsOrderLineService>(); var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); try { transaction.BeginTransaction(); serviceLine.Update(new WbsOrderLine() { LineStatus = 3 }, new WbsOrderLine() { OrderNo = orderNo }); serviceHeader.Update(new WbsOrder() { OrderStatus = 3 }, new WbsOrder() { OrderNo = orderNo }); transaction.CompleteTransaction(); } catch (Exception ex) { transaction.RollbackTransaction(); log.Error(ex); throw new VerifyException("数据删除失败"); } return(string.Empty); }
/// <summary> /// 添加单据信息 /// </summary> /// <param name="bill"></param> /// <param name="body"></param> /// <returns></returns> public string SaveOutputBill(WbsOrder bill, WbsOrderLine[] body) { var outHeaderService = TableViewServiceFactory.CreateInstance <IWbsOrderService>(); var outLineService = TableViewServiceFactory.CreateInstance <IWbsOrderLineService>(); var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); #region 单据验证 if (!VerifyAddBillData(bill, body)) { throw new VerifyException("单据验证失败!"); } #endregion transaction.BeginTransaction(); try { outHeaderService.Insert(bill); foreach (var line in body) { outLineService.Insert(line); } transaction.CompleteTransaction(); return(null); } catch (Exception ex) { transaction.RollbackTransaction(); return(ex.ToString()); } }
//重置任务优先级 public int[] ResetTaskEmerge(WbsTask[] tasks, int emerge) { #region 单据验证 if (!verifyResetTaskEmergeData(tasks)) { throw new VerifyException("任务验证失败!"); } #endregion var result = new List <int>(); var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); var service = TableViewServiceFactory.CreateInstance <IWbsTaskService>(); transaction.BeginTransaction(); try { foreach (var task in tasks) { service.Update(new WbsTask() { Emergency = emerge }, new WbsTask() { TaskNo = task.TaskNo, TaskStep = "01" }); } transaction.CompleteTransaction(); } catch (Exception ex) { log.Error(ex); transaction.RollbackTransaction(); throw ex; } return(result.ToArray()); }
/// <summary> /// 添加单据信息 /// </summary> /// <param name="bill"></param> /// <param name="body"></param> /// <returns></returns> public WbsOrder SaveOutputBill(WbsOrder bill, WbsOrderLine[] body) { var outHeaderService = TableViewServiceFactory.CreateInstance <IWbsOrderService>(); var outLineService = TableViewServiceFactory.CreateInstance <IWbsOrderLineService>(); var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); #region 单据验证 if (!VerifyAddBillData(bill, body)) { throw new VerifyException("单据验证失败!"); } #endregion transaction.BeginTransaction(); try { outHeaderService.Insert(bill); foreach (var line in body) { outLineService.Insert(line); } transaction.CompleteTransaction(); } catch (Exception ex) { transaction.RollbackTransaction(); throw ex; } return(outHeaderService.GetEntityList(new WbsOrder() { OrderNo = bill.OrderNo }).FirstOrDefault()); }
/// <summary> /// 获取库存信息统计 /// </summary> /// <param name="Btime"></param> /// <param name="Etime"></param> /// <returns></returns> public PageResult GetBinStoreBatchno(DateTime Btime, DateTime Etime, string batchNo) { var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); try { var procService = ProcedureServiceFactory.CreateInstance <IProcGetBinstoreBatchnoService>(); transaction.BeginTransaction(); var para = new ProcGetBinstoreBatchno(); para.IBtime = Btime; para.IEdate = Etime; para.IBatchNo = batchNo; procService.ExcuteProcedure(para); transaction.CompleteTransaction(); var pageResult = new PageResult(); var stmtId = "GetZ30BinStoreBatchNo"; pageResult.StatementId = stmtId; return(this.GetPageDataByReader(pageResult)); } catch (Exception ex) { transaction.RollbackTransaction(); return(null); } }
public string CancelSelectTask(WbsTask[] tasks, string FinishDesc, int TaskNo) { var transaction = TransactionServiceFatory.CreateInstance <ITransactionService>(); var procService = ProcedureServiceFactory.CreateInstance <IProcTaskFinishService>(); transaction.BeginTransaction(); try { procService.ExcuteProcedure(new ProcTaskFinish() { InTaskNo = TaskNo, InFinishDesc = FinishDesc }); transaction.CompleteTransaction(); } catch (Exception ex) { log.Error(ex); transaction.RollbackTransaction(); throw ex; } return(""); }