/// <summary>
        /// 初始存储数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public OpResult InitializestoreInspectionDetial(InspectionItemDataSummaryVM model)
        {
            InspectionIqcDetailModel datailModel = new InspectionIqcDetailModel()
            {
                OrderId               = model.OrderId,
                EquipmentId           = model.EquipmentId,
                MaterialCount         = model.MaterialInCount,
                InspecitonItem        = model.InspectionItem,
                InspectionAcceptCount = model.AcceptCount,
                InspectionCount       = model.InspectionCount,
                InspectionRefuseCount = model.RefuseCount,
                InspectionDate        = DateTime.Now,
                InspectionItemDatas   = model.InspectionItemDatas,
                InspectionItemResult  = model.InspectionItemResult,
                //InspectionItemStatus = model.InsptecitonItemIsFinished.ToString(),
                InspectionItemStatus = "doing",
                InspectionMode       = model.InspectionMode,
                MaterialId           = model.MaterialId,
                MaterialInDate       = model.MaterialInDate,
                FileName             = model.FileName,
                OpSign            = model.OpSign,
                Memo              = model.Memo,
                InspectionNGCount = model.InspectionNGCount,
                OpPerson          = model.OpPerson,
                DocumentPath      = model.DocumentPath
            };

            /// 判断是否存在此录入的项次
            if (InspectionManagerCrudFactory.IqcDetailCrud.isExiststroe(datailModel))
            {
                return(OpResult.SetErrorResult("不用添加"));
            }
            datailModel.OpSign = OpMode.Add;
            return(InspectionManagerCrudFactory.IqcDetailCrud.Store(datailModel, true));
        }
        /// <summary>
        /// 通过总表 存储Iqc检验详细数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public OpResult StoreInspectionIqcDetailModelForm(InspectionItemDataSummaryVM model, string siteRootPath)
        {
            InspectionIqcDetailModel datailModel = new InspectionIqcDetailModel()
            {
                OrderId               = model.OrderId,
                EquipmentId           = model.EquipmentId,
                MaterialCount         = model.MaterialInCount,
                InspecitonItem        = model.InspectionItem,
                InspectionAcceptCount = model.AcceptCount,
                InspectionCount       = model.InspectionCount,
                InspectionRefuseCount = model.RefuseCount,
                InspectionDate        = DateTime.Now,
                InspectionItemDatas   = model.InspectionItemDatas,
                InspectionItemResult  = model.InspectionItemResult,
                //InspectionItemStatus = model.InsptecitonItemIsFinished.ToString(),
                InspectionItemStatus = "doing",
                InspectionMode       = model.InspectionMode,
                MaterialId           = model.MaterialId,
                MaterialInDate       = model.MaterialInDate,
                FileName             = model.FileName,
                OpSign            = model.OpSign,
                Memo              = model.Memo,
                InspectionNGCount = model.InspectionNGCount,
                OpPerson          = model.OpPerson,
                DocumentPath      = model.DocumentPath,
                Id_Key            = model.Id_Key
            };

            return(storeInspectionDetial(datailModel, siteRootPath));
        }
 private OpResult storeInspectionDetial(InspectionIqcDetailModel model, string siteRootPath)
 {
     if (model != null && model.OpSign == OpMode.UploadFile)//如果是上传文件则启动上传文件处理程序
     {
         return(InspectionManagerCrudFactory.IqcDetailCrud.UploadFileIqcInspectionDetail(model, siteRootPath));
     }
     /// 判断是否存在此录入的项次
     if (InspectionManagerCrudFactory.IqcDetailCrud.isExiststroe(model))
     {
         model.OpSign = OpMode.Edit;
     }
     else
     {
         model.OpSign = OpMode.Add;
     }
     return(InspectionManagerCrudFactory.IqcDetailCrud.Store(model, true));
 }
 /// <summary>
 /// 加载已经录入的数据
 /// </summary>
 /// <param name="model"></param>
 /// <param name="iqcHaveInspectionData"></param>
 private void SetHaveInspectionItemDataVaule(InspectionItemDataSummaryVM model, InspectionIqcDetailModel iqcHaveInspectionData)
 {
     if (iqcHaveInspectionData != null)
     {
         model.InspectionItemDatas  = iqcHaveInspectionData.InspectionItemDatas;
         model.InspectionItemResult = iqcHaveInspectionData.InspectionItemResult;
         model.EquipmentId          = iqcHaveInspectionData.EquipmentId;
         model.InspectionItemStatus = iqcHaveInspectionData.InspectionItemStatus;
         model.Id_Key                    = iqcHaveInspectionData.Id_Key;
         model.Memo                      = iqcHaveInspectionData.Memo;
         model.InspectionMode            = iqcHaveInspectionData.InspectionMode;
         model.FileName                  = iqcHaveInspectionData.FileName;
         model.DocumentPath              = iqcHaveInspectionData.DocumentPath;
         model.InspectionCount           = iqcHaveInspectionData.InspectionCount;
         model.AcceptCount               = iqcHaveInspectionData.InspectionAcceptCount;
         model.RefuseCount               = iqcHaveInspectionData.InspectionRefuseCount;
         model.InsptecitonItemIsFinished = true;
         model.NeedFinishDataNumber      = (int)iqcHaveInspectionData.InspectionCount;
         model.HaveFinishDataNumber      = DoHaveFinishDataNumber(iqcHaveInspectionData.InspectionItemResult, iqcHaveInspectionData.InspectionItemDatas, model.NeedFinishDataNumber);
     }
 }