Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        public Enrolment AddEnrolment(Enrolment newEnrolment, EnrolmentType enrolmentType, string OrgDepCode, string userName, string mainId)
        {
            Enrolment rtEnrolment = null;

            try
            {
                newEnrolment.enrolment_number = _sysBillNoService.GetBillNo(enrolmentType.bill_number_id.Value, OrgDepCode);
                newEnrolment.enrolment_date   = _sPGetSysDateTimeService.GetSysDateTime();
                newEnrolment.EnrolmentType    = enrolmentType;
                if (newEnrolment.status == (int)EnrolmentStatue.确认)
                {
                    //如果确认状态,则可直接赋值confirmdate
                    newEnrolment.confirm_date = newEnrolment.enrolment_date;
                }
                _unitOfWork.AddAction(newEnrolment, DataActions.Add);
                if (mainId != "")
                {
                    //有标签发行
                    _rfidTagIssueService.AddRFIDTagIssueWithEnrolment(newEnrolment, mainId, userName);
                }

                if (newEnrolment.status != (int)EnrolmentStatue.新建)
                {
                    //新建状态不创建计划
                    _planTaskService.AddPlanTaskWithEnrolment(newEnrolment, enrolmentType.PlanTaskType, OrgDepCode);
                }

                _unitOfWork.Save();
                rtEnrolment = newEnrolment;
            }
            catch (DataMisalignedException ex)
            {
                throw ex;
            }
            catch (RepositoryException ex)
            {
                throw ex;
            }
            return(rtEnrolment);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        ///
        /// <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);
        }
Ejemplo n.º 6
0
        /// <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);
        }