public PlanTaskBatchAdjust AddPlantaskAdjustWithWarehouseInfor(PlanTaskBatchAdjust newplanAdjust, string OrgDepCode) { PlanTaskBatchAdjust rtnplantaskbatchAdjust = null; try { _unitOfWork.Actions.Clear(); int billId = _sysBillNoService.GetBillNoID("MAN", "PAN"); newplanAdjust.plantask_batch_adjust_number = _sysBillNoService.GetBillNo(billId, OrgDepCode); newplanAdjust.adjust_time = _sPGetSysDateTimeService.GetSysDateTime(); _unitOfWork.AddAction(newplanAdjust, DataActions.Add); //_warehouseStoreInfoService.UpdateWarehouseStoreInfoWithPlanTaskBatchAdjust(newplanAdjust); _unitOfWork.Save(); } catch (RepositoryException ex) { throw ex; } return(rtnplantaskbatchAdjust); }
public Assay AddAssayWithUnitOfWork(Sample newSample, SampleDetail newSampleDetail, int user_id, Contract cont, IList <GrainQualityIndex> GrainQualityIndexList, List <string> resultList, AssayStatus status, string AssayBillIndex, OrganizationDepartment org, int gradeID) { Assay newAssay = new Assay(); int billID = _sysBillNoService.GetBillNoID("QUM", "ASN"); newAssay.assay_number = _sysBillNoService.GetBillNo(billID); //newAssay.assay_result = null; //newAssay.bill_owner_org = 1; //newAssay.confirm_time = null; newAssay.confirm_user = user_id; newAssay.create_time = _sPGetSysDateTimeService.GetSysDateTime(); newAssay.grain_grade = gradeID; newAssay.remark = ""; newAssay.sample_number = newSample.sample_number; newAssay.status = (int)status; _unitOfWork.AddAction(newAssay, DataActions.Add); AddAssayBillWithUnitOfWork(newAssay, user_id, newSampleDetail, cont, GrainQualityIndexList, resultList, AssayBillIndex); //newAssay.grain_grade = JudgeGrainGrade(newAssay.AssayBills.First().AssayResults, return(newAssay); }
/// /// <param name="newEquipmentPlan"></param> public EquipmentPlan CreateEquipmentPlan(EquipmentPlan newEquipmentPlan, string billNoSystem, string billNoPrefix) { EquipmentPlan returnEquipmentPlan = null; try { //设备维护单号 int billNoID = _sysBillNoService.GetBillNoID(billNoSystem, billNoPrefix); if (billNoID > 0) { newEquipmentPlan.equipment_plan_number = _sysBillNoService.GetBillNo(billNoID); } _unitOfWork.AddAction(newEquipmentPlan, DataActions.Add); _unitOfWork.Save(); returnEquipmentPlan = newEquipmentPlan; } catch (RepositoryException ex) { throw ex; } return(returnEquipmentPlan); }
/// <summary> /// 新建出入库记录 /// </summary> /// <param name="warehouseStoreInfo">仓储保管帐信息</param> /// <param name="planTaskBatchDetail">计划批次明细</param> /// <param name="isOutWarehouseStoreInfo">是否倒仓出库标志</param> /// <returns>创建完成的出入库记录</returns> private WarehouseInOutRecord AddWarehouseInOutRecordWithStoreInfoAndBatchDetail(WarehouseStoreInfo warehouseStoreInfo, PlanTaskBatchDetail planTaskBatchDetail, bool isOutWarehouseStoreInfo, string orgCode, bool isOutInFlag) { WarehouseInOutRecord warehouseInOutRecord = null; PlanTaskBatch planTaskBatch = planTaskBatchDetail.PlanTaskBatch; warehouseInOutRecord = new WarehouseInOutRecord(); int sysBillNoID = _sysBillNoService.GetBillNoID(MESSystem.whm, BillPrefix.ioh); //warehouseInOutRecord.record_number = AisinoMesServiceHelper.GetOriginalDept(planTaskBatch.PlanTask.Enrolment.OrganizationEmployee1) + _sysBillNoService.GetBillNo(sysBillNoID); if (isOutWarehouseStoreInfo) { //如果是倒仓出入,则前缀增加O warehouseInOutRecord.record_number = orgCode + "O" + _sysBillNoService.GetBillNo(sysBillNoID) + planTaskBatch.generate_id; } else { warehouseInOutRecord.record_number = orgCode + _sysBillNoService.GetBillNo(sysBillNoID) + planTaskBatch.generate_id; } warehouseInOutRecord.record_status = (int)RecordStatus.效; warehouseInOutRecord.registe_type = (int)WarehouseInOutRecordRegisteType.系统登记; if (!isOutWarehouseStoreInfo) { //不是倒仓,则不论出入库都使用warehouse_id warehouseInOutRecord.warehouse_id = planTaskBatchDetail.warehouse_id; warehouseInOutRecord.grain_kind = planTaskBatch.PlanTask.goods_kind.Value; if (planTaskBatch.PlanTask.Enrolment == null) { warehouseInOutRecord.record_type = (int)RecordType.入库; if (warehouseInOutRecord.balance_count == null) { warehouseInOutRecord.balance_count = planTaskBatchDetail.weight; } else { warehouseInOutRecord.balance_count += planTaskBatchDetail.weight; } } else { if (planTaskBatch.PlanTask.Enrolment.inout_type == (int)InOutType.入库) { warehouseInOutRecord.record_type = (int)RecordType.入库; if (warehouseInOutRecord.balance_count == null) { warehouseInOutRecord.balance_count = planTaskBatchDetail.weight; } else { warehouseInOutRecord.balance_count += planTaskBatchDetail.weight; } } else { warehouseInOutRecord.record_type = (int)RecordType.出库; warehouseInOutRecord.balance_count -= planTaskBatchDetail.weight; } } } else { //记录倒仓仓号 warehouseInOutRecord.warehouse_id = planTaskBatchDetail.outwarehouse; warehouseInOutRecord.grain_kind = warehouseStoreInfo.grain_kind; warehouseInOutRecord.record_type = (int)RecordType.出库; warehouseInOutRecord.balance_count -= planTaskBatchDetail.weight; } warehouseInOutRecord.warehouse_store_info = warehouseStoreInfo.warehouse_store_id; warehouseInOutRecord.work_plan = planTaskBatch.plantask_batch_number; warehouseInOutRecord.inout_datetime = planTaskBatchDetail.weight_time == null ? "" : planTaskBatchDetail.weight_time.Value.ToString("yyyyMMddHHmmss"); warehouseInOutRecord.inout_finished = true; warehouseInOutRecord.location_flag = false; warehouseInOutRecord.manual_registe = false; warehouseInOutRecord.record_count = planTaskBatchDetail.weight; if (isOutInFlag) { if (isOutWarehouseStoreInfo) { warehouseInOutRecord.record_type = (int)RecordType.倒仓出库; } else { warehouseInOutRecord.record_type = (int)RecordType.倒仓入库; } } _unitOfWork.AddAction(warehouseInOutRecord, DAL.Enums.DataActions.Add); return(warehouseInOutRecord); }