public WarehouseTransactionHead UpdateWarehTranHead(WarehouseTransactionHead updateWarehTranHead) { WarehouseTransactionHead returnWarehTranHead = null; try { _warehTransactionHeadDal.Update(updateWarehTranHead); returnWarehTranHead = updateWarehTranHead; } catch (RepositoryException ex) { throw ex; } return(returnWarehTranHead); }
public WarehouseTransactionHead AddWarehTranHead(WarehouseTransactionHead newWarehTranHead) { WarehouseTransactionHead returnWarehTranHead = null; try { _warehTransactionHeadDal.Add(newWarehTranHead); returnWarehTranHead = newWarehTranHead; } catch (RepositoryException ex) { throw ex; } return(returnWarehTranHead); }
public void ModifyWarehTranHead(WarehouseTransactionHead warehTranHead, int billNoID) { try { _unitOfWork.Actions.Clear(); //获取billNoID warehTranHead.bill_no = _sysBillNoService.GetBillNo(billNoID); _unitOfWork.AddAction(warehTranHead, DataActions.Add); _unitOfWork.Save(); } catch (AisinoMesServiceException ex) { throw ex; } }
public void ConfirmWarehTranHead(WarehouseTransactionHead warehTranHead) { try { _unitOfWork.Actions.Clear(); //表单头更新 _unitOfWork.AddAction(warehTranHead, DataActions.Update); //如果是期初入库单,没有Amount,Invmas; if (warehTranHead.bill_type_id == GetMotifyTypes(MESSystem.whm).Single(b => b.bill_name == "期初入库单" || b.prefix == "WOI").id) { //表单详细更新 foreach (WarehouseTransactionDetail wtDetail in warehTranHead.WarehouseTransactionDetails) { //更新WarehouseAmount WarehouseAmount amount = new WarehouseAmount(); amount.warehouse_id = wtDetail.warehouse_id.Value; amount.current_amount = wtDetail.tran_quantity.Value; amount.invmas_id = wtDetail.invmas_id.Value; amount.expectation_in_amount = 0; amount.expectation_out_amount = 0; _unitOfWork.AddAction(amount, DataActions.Add); //更新WarehouseAmountChangeDetail WarehouseAmountChangeDetail amountDetail = new WarehouseAmountChangeDetail(); amountDetail.invmas_id = wtDetail.invmas_id; amountDetail.tran_date = wtDetail.tran_time; //amountDetail.tran_detail_id = amountDetail.tran_quantity = wtDetail.tran_quantity; amountDetail.trans_type = 1; amountDetail.trno = warehTranHead.bill_no; amountDetail.trseq = wtDetail.tran_seq; //amountDetail.trtype = amountDetail.warehouse_id = wtDetail.warehouse_id; _unitOfWork.AddAction(amountDetail, DataActions.Add); } } else { //表单详细更新 foreach (WarehouseTransactionDetail wtDetail in warehTranHead.WarehouseTransactionDetails) { //更新WarehouseAmount WarehouseAmount amount = wtDetail.Warehouse.WarehouseAmounts.ToList()[0]; amount.current_amount = wtDetail.tran_quantity.Value; _unitOfWork.AddAction(amount, DataActions.Update); //更新WarehouseAmountChangeDetail WarehouseAmountChangeDetail amountDetail = new WarehouseAmountChangeDetail(); amountDetail.invmas_id = wtDetail.invmas_id; amountDetail.tran_date = wtDetail.tran_time; //amountDetail.tran_detail_id = amountDetail.tran_quantity = wtDetail.tran_quantity; amountDetail.trans_type = 1; amountDetail.trno = warehTranHead.bill_no; amountDetail.trseq = wtDetail.tran_seq; // amountDetail.trtype = amountDetail.warehouse_id = wtDetail.warehouse_id; _unitOfWork.AddAction(amountDetail, DataActions.Add); } } _unitOfWork.Save(); } catch (AisinoMesServiceException ex) { throw ex; } }