public Model.BPM_Order DataRowToModel(DataRow row) { Model.BPM_Order model = new Model.BPM_Order(); if (row != null) { if (row["TA001"] != null && row["TA002"] != null) { model.OrderID = row["TA001"].ToString().Replace(" ", "") + "-" + row["TA002"].ToString().Replace(" ", ""); } if (row["TA006"] != null) { model.ProductID = row["TA006"].ToString(); } if (row["TA034"] != null) { model.ProductName = row["TA034"].ToString(); } if (row["TA035"] != null) { model.Spec = row["TA035"].ToString(); } if (row["TA015"] != null) { model.Count = double.Parse(row["TA015"].ToString()); } if (row["TA009"] != null) { model.StartDate = row["TA009"].ToString(); } if (row["TA010"] != null) { model.EndDate = row["TA010"].ToString(); } if (row["TA011"] != null) { string state = row["TA011"].ToString(); switch (state) { case "1": model.State = "未生产"; break; case "2": model.State = "已发料"; break; case "3": model.State = "生产中"; break; case "Y": model.State = "已完工"; break; case "y": model.State = "指定完工"; break; default: break; } } if (row["TA012"] != null) { model.ActualStartDate = row["TA012"].ToString(); } if (row["TA014"] != null) { model.ActualEndDate = row["TA014"].ToString(); } if (row["TA017"] != null) { model.InStorageCount = double.Parse(row["TA017"].ToString()); } model.IsRemind = false; } BPM_Product product = new BPM_Product(); model.Product = product.GetModel(model.ProductID); //产品信息 return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.BPM_Order DataRowToModel(DataRow row) { MES.Server.Model.BPM_Order model = new MES.Server.Model.BPM_Order(); if (row != null) { if (row["OrderID"] != null) { model.OrderID = row["OrderID"].ToString(); } if (row["ClientName"] != null) { model.ClientName = row["ClientName"].ToString(); } if (row["ProductID"] != null) { model.ProductID = row["ProductID"].ToString(); } if (row["ProductName"] != null) { model.ProductName = row["ProductName"].ToString(); } if (row["Spec"] != null) { model.Spec = row["Spec"].ToString(); } if (row["Count"] != null && row["Count"].ToString() != "") { model.Count = double.Parse(row["Count"].ToString()); } if (row["TotalWorkHoursStandard"] != null && row["TotalWorkHoursStandard"].ToString() != "") { model.TotalWorkHoursStandard = double.Parse(row["TotalWorkHoursStandard"].ToString()); } if (row["StartDate"] != null) { model.StartDate = row["StartDate"].ToString(); } if (row["EndDate"] != null) { model.EndDate = row["EndDate"].ToString(); } if (row["ActualStartDate"] != null) { model.ActualStartDate = row["ActualStartDate"].ToString(); } if (row["ActualEndDate"] != null) { model.ActualEndDate = row["ActualEndDate"].ToString(); } if (row["DeliveryDate"] != null && row["DeliveryDate"].ToString() != "") { model.DeliveryDate = DateTime.Parse(row["DeliveryDate"].ToString()); } if (row["Qty"] != null) { model.Qty = row["Qty"].ToString(); } if (row["PN"] != null) { model.PN = row["PN"].ToString(); } if (row["PO"] != null) { model.PO = row["PO"].ToString(); } if (row["WorkDepartment"] != null) { model.WorkDepartment = row["WorkDepartment"].ToString(); } if (row["WorkShop"] != null) { model.WorkShop = row["WorkShop"].ToString(); } if (row["State"] != null) { model.State = row["State"].ToString(); } if (row["Relax"] != null && row["Relax"].ToString() != "") { model.Relax = double.Parse(row["Relax"].ToString()); } if (row["IsRemind"] != null && row["IsRemind"].ToString() != "") { if ((row["IsRemind"].ToString() == "1") || (row["IsRemind"].ToString().ToLower() == "true")) { model.IsRemind = true; } else { model.IsRemind = false; } } if (row["ID_Key"] != null && row["ID_Key"].ToString() != "") { model.ID_Key = decimal.Parse(row["ID_Key"].ToString()); } } BPM_Product product = new BPM_Product(); model.Product = product.GetModel(model.ProductID); //产品信息 return(model); }