/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Pdm_shift View2Model(ModelView.PdmShiftView view) { Model.TableModel.Pdm_shift model = new Model.TableModel.Pdm_shift(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.shift_no = string.IsNullOrEmpty(view.shift_no) ? globalDataCtrl.GetNextNoByTblName("pdm_shift") : view.shift_no; model.shift_name = view.shift_name; if (string.IsNullOrEmpty(view.shift_start_time)) { model.shift_start_time = new DateTime(1900, 1, 1, 0, 0, 0); } else { DateTime dt = new DateTime(1900, 1, 1, 0, 0, 0); model.shift_start_time = DateTime.TryParse(string.Format("1900-01-01 {0}:00.000", view.shift_start_time), out dt) ? dt : new DateTime(1900, 1, 1, 0, 0, 0); } if (string.IsNullOrEmpty(view.shift_stop_time)) { model.shift_stop_time = new DateTime(1900, 1, 1, 0, 0, 0); } else { DateTime dt = new DateTime(1900, 1, 1, 0, 0, 0); model.shift_stop_time = DateTime.TryParse(string.Format("1900-01-01 {0}:00.000", view.shift_stop_time), out dt) ? dt : new DateTime(1900, 1, 1, 0, 0, 0); } int startHour = model.shift_start_time.Hour; int startMinute = model.shift_start_time.Minute; int stopHour = model.shift_stop_time.Hour; int stopMinute = model.shift_stop_time.Minute; int minute = stopHour * 60 + stopMinute - startHour * 60 - startMinute; model.shift_length = minute >= 0 ? minute : 0; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Sys_auth_group View2Model(ModelView.SysAuthGroupView view) { Model.TableModel.Sys_auth_group model = new Model.TableModel.Sys_auth_group(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; model.auth_group_name = view.auth_group_name; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.auth_group_no = string.IsNullOrEmpty(view.auth_group_no) ? globalDataCtrl.GetNextNoByTblName("sys_auth_group") : view.auth_group_no; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Qcm_quality View2Model(ModelView.QcmQualityView view) { Model.TableModel.Qcm_quality model = new Model.TableModel.Qcm_quality(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.quality_no = string.IsNullOrEmpty(view.quality_no) ? globalDataCtrl.GetNextNoByTblName("qcm_quality") : view.quality_no; model.quality_name = view.quality_name; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Apo_act View2Model(ModelView.ApoActView view) { Model.TableModel.Apo_act model = new Model.TableModel.Apo_act(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.act_no = string.IsNullOrEmpty(view.act_no) ? globalDataCtrl.GetNextNoByTblName("apo_act") : view.act_no; model.apo_no = string.IsNullOrEmpty(view.apo_no)?"ApoNo":view.apo_no; model.apo_item_no = string.IsNullOrEmpty(view.apo_item_no) ? "ApoItemNo" : view.apo_item_no; model.apo_item_name = string.IsNullOrEmpty(view.apo_item_name) ? "ApoItemName" : view.apo_item_name; int tmpInt = 0; model.apo_index = string.IsNullOrEmpty(view.apo_index) ? 0 : (int.TryParse(view.apo_index, out tmpInt)?tmpInt:0); model.next_item_no = string.IsNullOrEmpty(view.next_item_no) ? "NextItemNo" : view.next_item_no; model.next_item_name = string.IsNullOrEmpty(view.next_item_name) ? "NextItemName" : view.next_item_name; model.next_user_name = string.IsNullOrEmpty(view.next_user_name) ? "NextUserName" : view.next_user_name; model.act_desc = view.act_desc; model.act_result = view.act_result == "通过" ? true : false; model.act_step = string.IsNullOrEmpty(view.act_step) ? 0 : (int.TryParse(view.act_step, out tmpInt) ? tmpInt : 0); model.act_user_no = string.IsNullOrEmpty(view.act_user_no) ? "ActUserNo" : view.act_user_no; model.act_user_name = string.IsNullOrEmpty(view.act_user_name) ? "ActUserName" : view.act_user_name; DateTime dt = DateTime.Now; model.act_time = string.IsNullOrEmpty(view.act_time) ? DateTime.Now : DateTime.TryParse(view.act_time, out dt)?dt:DateTime.Now; model.ralate_no = string.IsNullOrEmpty(view.ralate_no) ? "RalateNo" : view.ralate_no; model.ralate_file_name = string.IsNullOrEmpty(view.ralate_file_name) ? "RalateFileName" : view.ralate_file_name; model.ralate_file_extension = string.IsNullOrEmpty(view.ralate_file_extension) ?"RalateFileExtension": view.ralate_file_extension; model.ralate_type_no = string.IsNullOrEmpty(view.ralate_type_no) ? "RalateTypeNo" : view.ralate_type_no; model.step_finished = view.step_finished == "是" ? true : false; model.apo_finished = view.apo_finished == "是" ? true : false; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Adn View2Model(ModelView.AdnView view) { Model.TableModel.Adn model = new Model.TableModel.Adn(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.andon_no = string.IsNullOrEmpty(view.andon_no) ? globalDataCtrl.GetNextNoByTblName("adn") : view.andon_no; model.andon_type_no = string.IsNullOrEmpty(view.andon_type_no) ? "01" : view.andon_type_no; model.andon_type_name = view.andon_type_name; model.andon_desc = view.andon_desc; model.dept_no = view.dept_no; model.eqm_no = string.IsNullOrEmpty(view.eqm_no)?"Default":view.eqm_no; model.andon_music_no = (model.dept_no + "_" + model.eqm_no + ".mp3").Replace("?", "").Replace("*", "").Replace(":", "\"").Replace("<", "").Replace(">", "").Replace("\\", "").Replace("/", "").Replace("|", ""); model.call_user_no = string.IsNullOrEmpty(view.call_user_no) ? "Server" : view.call_user_no; model.call_user_name = string.IsNullOrEmpty(view.call_user_name) ? "Server" : view.call_user_name; DateTime dt = DateTime.Now; model.call_time = DateTime.TryParse(view.call_time, out dt) ? dt : DateTime.Now; model.reply_user_no = string.IsNullOrEmpty(view.call_user_no) ? "Server" : view.call_user_no; model.reply_user_name = string.IsNullOrEmpty(view.call_user_name) ? "Server" : view.call_user_name; dt = DateTime.Now; model.reply_time = string.IsNullOrEmpty(view.reply_time) ? (DateTime?)null : (DateTime.TryParse(view.reply_time, out dt) ? dt : DateTime.Now); model.ralate_no = view.ralate_no; model.is_finished = string.IsNullOrEmpty(view.is_finished)?false:(view.is_finished == "是" ? true : false); GlobalDataCtrl gdc = new GlobalDataCtrl(); string tmp = gdc.GetStrByField("andon_play_eqm", "adn_type", "andon_type_no", model.andon_type_no); model.play_record = string.IsNullOrEmpty(tmp)?"0":tmp; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Eqm_jam_record View2Model(ModelView.EqmJamRecordView view) { Model.TableModel.Eqm_jam_record model = new Model.TableModel.Eqm_jam_record(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; model.crt_user_no = string.IsNullOrEmpty(view.crt_user_no) ? "Server" : view.crt_user_no; model.crt_user_name = string.IsNullOrEmpty(view.crt_user_name) ? "Server" : view.crt_user_name; DateTime dt = DateTime.Now; model.crt_time = DateTime.TryParse(view.crt_time, out dt) ? dt : DateTime.Now; model.upd_user_no = string.IsNullOrEmpty(view.upd_user_no) ? "Server" : view.upd_user_no; model.upd_user_name = string.IsNullOrEmpty(view.upd_user_name) ? "Server" : view.upd_user_name; dt = DateTime.Now; model.upd_time = DateTime.TryParse(view.upd_time, out dt) ? dt : DateTime.Now; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.jam_record_no = string.IsNullOrEmpty(view.jam_record_no) ? globalDataCtrl.GetNextNoByTblName("eqm_jam_record") : view.jam_record_no; model.jam_cause_no = view.jam_cause_no; model.jam_cause_name = view.jam_cause_name; model.eqm_no = string.IsNullOrEmpty(view.eqm_no) ? "EqmNo" : view.eqm_no; model.wkc_no = string.IsNullOrEmpty(view.wkc_no) ? "WkcNo" : view.wkc_no; model.submit_user_no = string.IsNullOrEmpty(view.submit_user_no) ? "Server" : view.submit_user_no; model.submit_user_name = string.IsNullOrEmpty(view.submit_user_name) ? "Server" : view.submit_user_name; dt = DateTime.Now; model.submit_time = DateTime.TryParse(view.submit_time, out dt) ? dt : DateTime.Now; model.reply_user_no = string.IsNullOrEmpty(view.reply_user_no) ? "Server" : view.reply_user_no; model.reply_user_name = string.IsNullOrEmpty(view.reply_user_name) ? "Server" : view.reply_user_name; dt = DateTime.Now; model.reply_time = DateTime.TryParse(view.reply_time, out dt) ? dt : DateTime.Now; model.ralate_no = view.ralate_no; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Pdm_workshop View2Model(ModelView.PdmWorkshopView view) { Model.TableModel.Pdm_workshop model = new Model.TableModel.Pdm_workshop(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.workshop_no = string.IsNullOrEmpty(view.workshop_no) ? globalDataCtrl.GetNextNoByTblName("pdm_workshop") : view.workshop_no; model.workshop_name = view.workshop_name; model.factory_no = string.IsNullOrEmpty(view.factory_no) ? "dfs_f" : view.factory_no; model.factory_name = view.factory_name; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Qcm_qa_cause View2Model(ModelView.QcmQaCauseView view) { Model.TableModel.Qcm_qa_cause model = new Model.TableModel.Qcm_qa_cause(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.qa_cause_no = string.IsNullOrEmpty(view.qa_cause_no) ? globalDataCtrl.GetNextNoByTblName("qcm_qa_quality") : view.qa_cause_no; model.qa_cause_name = view.qa_cause_name; model.qa_cause_py = view.qa_cause_py; model.qa_cause_is_default = !string.IsNullOrEmpty(view.qa_cause_is_default) && view.qa_cause_is_default == "是"; model.factory_no = view.factory_no; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Sys_dept View2Model(ModelView.SysDeptView view) { Model.TableModel.Sys_dept model = new Model.TableModel.Sys_dept(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.dept_no = string.IsNullOrEmpty(view.dept_no) ? globalDataCtrl.GetNextNoByTblName("sys_dept") : view.dept_no; model.dept_name = view.dept_name; model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; model.dept_no = string.IsNullOrEmpty(view.dept_no) ? "01" : view.dept_no; model.dept_name_py = view.dept_name_py; model.company_no = string.IsNullOrEmpty(view.company_no) ? "dfs_c" : view.company_no; model.company_name = view.company_name; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Pdm_line View2Model(ModelView.PdmLineView view) { Model.TableModel.Pdm_line model = new Model.TableModel.Pdm_line(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.line_no = string.IsNullOrEmpty(view.line_no) ? globalDataCtrl.GetNextNoByTblName("pdm_line") : view.line_no; model.line_name = view.line_name; model.line_desc = view.line_desc; model.workshop_no = string.IsNullOrEmpty(view.workshop_no) ? "ws01" : view.workshop_no; model.workshop_name = view.workshop_name; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Sys_factory View2Model(ModelView.SysFactoryView view) { Model.TableModel.Sys_factory model = new Model.TableModel.Sys_factory(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; model.status_name = view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.factory_no = string.IsNullOrEmpty(view.factory_no) ? globalDataCtrl.GetNextNoByTblName("sys_factory") : view.factory_no; model.factory_name = view.factory_name; model.factory_name_py = view.factory_name_py; model.factory_type = view.factory_type; model.company_no = view.company_no; model.company_name = view.company_name; return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Sys_product_record_setting View2Model(ModelView.SysProductRecordSettingView view) { Model.TableModel.Sys_product_record_setting model = new Model.TableModel.Sys_product_record_setting(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; DateTime dt = DateTime.Now; model.crt_time = DateTime.TryParse(view.crt_time, out dt) ? dt : DateTime.Now; model.crt_user_no = string.IsNullOrEmpty(view.crt_user_no) ? "Server" : view.crt_user_no; model.crt_user_name = view.crt_user_name; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.product_record_no = string.IsNullOrEmpty(view.product_record_no) ? globalDataCtrl.GetNextNoByTblName("sys_product_record_setting") : view.product_record_no; model.product_record_name = string.IsNullOrEmpty(view.product_record_name)?"ProductRecordName":view.product_record_name; model.eqm_no = string.IsNullOrEmpty(view.eqm_no)?"EqmNo":view.eqm_no; int intTmp = 0; model.row_index = string.IsNullOrEmpty(view.row_index) ? 0 : (int.TryParse(view.row_index, out intTmp) ? intTmp : 0); model.col_index = string.IsNullOrEmpty(view.col_index) ? 0 : (int.TryParse(view.col_index, out intTmp) ? intTmp : 0); return(model); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Sys_user View2Model(ModelView.SysUserView view) { Model.TableModel.Sys_user model = new Model.TableModel.Sys_user(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.user_no = string.IsNullOrEmpty(view.user_no) ? globalDataCtrl.GetNextNoByTblName("sys_user") : view.user_no; model.user_name = view.user_name; model.user_card_id = view.user_card_id; model.user_card_no = view.user_card_no; model.user_pwd = string.IsNullOrEmpty(view.user_pwd) ? Common.Md5Operate.GetMD5String("123456") : Common.Md5Operate.GetMD5String(view.user_pwd); switch (view.user_gender) { case "男": model.user_gender = "男"; break; case "女": model.user_gender = "女"; break; default: model.user_gender = "未知"; break; } if (view.loginable == "是") { model.loginable = true; } else { model.loginable = false; } if (view.pwd_changeable == "是") { model.pwd_changeable = true; } else { model.pwd_changeable = false; } DateTime dt = DateTime.Now; if (string.IsNullOrEmpty(view.valid_start_time)) { model.valid_start_time = null; } else { model.valid_start_time = DateTime.TryParse(view.valid_start_time, out dt) ? dt:(DateTime?)null; } if (string.IsNullOrEmpty(view.valid_stop_time)) { model.valid_stop_time = null; } else { model.valid_stop_time = DateTime.TryParse(view.valid_stop_time, out dt) ? dt : (DateTime?)null; } model.user_position = view.user_position; model.user_email = view.user_email; model.user_phone = view.user_phone; model.user_mobile = view.user_mobile; model.user_address = view.user_address; model.company_no = string.IsNullOrEmpty(view.company_no) ? "dfs_c" : view.company_no; model.dept_no = string.IsNullOrEmpty(view.dept_no) ? "01" : view.dept_no; model.factory_no = string.IsNullOrEmpty(view.factory_no) ? "dfs_f" : view.factory_no; model.workshop_no = string.IsNullOrEmpty(view.workshop_no) ? "ws01" : view.workshop_no; model.line_no = string.IsNullOrEmpty(view.line_no) ? "line01" : view.line_no; if (view.pwd_changeable == "是") { model.pwd_changeable = true; } else { model.pwd_changeable = false; } return(model); }