/// <summary> /// Create BomRepleaceConditionInfo /// </summary> /// <param name="loginUser"></param> /// <returns>BomRepleaceConditionInfo</returns> public static BomRepleaceConditionInfo CreateBomRepleaceConditionInfo(string loginUser) { BomRepleaceConditionInfo info = new BomRepleaceConditionInfo(); ///ID info.Id = new long(); ///FID info.Fid = Guid.NewGuid(); ///CONDITION_CODE info.ConditionCode = null; ///OLD_PART_NO info.OldPartNo = null; ///NEW_PART_NO info.NewPartNo = null; ///OLD_SUPPLIER_NUM info.OldSupplierNum = null; ///NEW_SUPPLIER_NUM info.NewSupplierNum = null; ///OLD_LOCATION info.OldLocation = null; ///NEW_LOCATION info.NewLocation = null; ///OLD_PART_VERSION info.OldPartVersion = null; ///NEW_PART_VERSION info.NewPartVersion = null; ///OLD_PART_QTY info.OldPartQty = null; ///NEW_PART_QTY info.NewPartQty = null; ///START_PORDER_CODE info.StartPorderCode = null; ///PORDER_START_TIME info.PorderStartTime = null; ///PORDER_END_TIME info.PorderEndTime = null; ///EXECUTE_START_TIME info.ExecuteStartTime = null; ///EXECUTE_END_TIME info.ExecuteEndTime = null; ///STATUS info.Status = null; ///COMMENTS info.Comments = null; ///VALID_FLAG info.ValidFlag = true; ///CREATE_DATE info.CreateDate = DateTime.Now; ///CREATE_USER info.CreateUser = loginUser; ///MODIFY_DATE info.ModifyDate = null; ///MODIFY_USER info.ModifyUser = null; return(info); }
/// <summary> /// LogicDeleteInfo /// </summary> /// <param name="id">主键</param> /// <param name="loginUser">用户</param> /// <returns></returns> public bool LogicDeleteInfo(long id, string loginUser) { BomRepleaceConditionInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.Status != (int)BreakPointOrderStatusConstants.Created) { throw new Exception("MC:0x00000415");///已创建状态才可进行删除 } return(dal.LogicDelete(id, loginUser) > 0 ? true : false); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields">更新字段</param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { BomRepleaceConditionInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.Status != (int)BreakPointOrderStatusConstants.Created) { throw new Exception("MC:0x00000084");///已创建状态才可进行修改 } string newLocation = CommonBLL.GetFieldValue(fields, "NEW_LOCATION"); string oldLocation = CommonBLL.GetFieldValue(fields, "OLD_LOCATION"); if ((string.IsNullOrEmpty(newLocation) && !string.IsNullOrEmpty(oldLocation)) || (!string.IsNullOrEmpty(newLocation) && string.IsNullOrEmpty(oldLocation))) { throw new Exception("MC:0x00000491");///新旧工位必须同时填写或者同时不填 } string newPartQty = CommonBLL.GetFieldValue(fields, "NEW_PART_QTY"); string oldPartQty = CommonBLL.GetFieldValue(fields, "OLD_PART_QTY"); if ((newPartQty != "null" && oldPartQty == "null") || (newPartQty == "null" && oldPartQty != "null")) { throw new Exception("MC:0x00000492");///新旧物料用量必须同时填写或者同时不填 } string newPartNo = CommonBLL.GetFieldValue(fields, "NEW_PART_NO"); string oldPartNo = CommonBLL.GetFieldValue(fields, "OLD_PART_NO"); if ((string.IsNullOrEmpty(newPartNo) && !string.IsNullOrEmpty(oldPartNo)) || (!string.IsNullOrEmpty(newPartNo) && string.IsNullOrEmpty(oldPartNo))) { throw new Exception("MC:0x00000493");///新旧物料号必须同时填写或者同时不填 } string newSupplierNum = CommonBLL.GetFieldValue(fields, "NEW_SUPPLIER_NUM"); string oldSupplierNum = CommonBLL.GetFieldValue(fields, "OLD_SUPPLIER_NUM"); if ((string.IsNullOrEmpty(newSupplierNum) && !string.IsNullOrEmpty(oldSupplierNum)) || (!string.IsNullOrEmpty(newSupplierNum) && string.IsNullOrEmpty(oldSupplierNum))) { throw new Exception("MC:0x00000494");///新旧供应商必须同时填写或者同时不填 } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }
/// <summary> /// InsertInfo /// </summary> /// <param name="info">对象</param> /// <returns></returns> public long InsertInfo(BomRepleaceConditionInfo info) { info.ConditionCode = new SeqDefineDAL().GetCurrentCode("CONDITION_CODE"); info.Status = (int)BreakPointOrderStatusConstants.Created; if ((info.NewPartQty != null && info.OldPartQty == null) || (info.NewPartQty == null && info.OldPartQty != null)) { throw new Exception("MC:0x00000492");///新旧物料用量必须同时填写或者同时不填 } if ((string.IsNullOrEmpty(info.NewPartNo) && !string.IsNullOrEmpty(info.OldPartNo)) || (!string.IsNullOrEmpty(info.NewPartNo) && string.IsNullOrEmpty(info.OldPartNo))) { throw new Exception("MC:0x00000493");///新旧物料号必须同时填写或者同时不填 } if ((string.IsNullOrEmpty(info.NewSupplierNum) && !string.IsNullOrEmpty(info.OldSupplierNum)) || (!string.IsNullOrEmpty(info.NewSupplierNum) && string.IsNullOrEmpty(info.OldSupplierNum))) { throw new Exception("MC:0x00000494");///新旧供应商必须同时填写或者同时不填 } if ((string.IsNullOrEmpty(info.NewLocation) && !string.IsNullOrEmpty(info.OldLocation)) || (!string.IsNullOrEmpty(info.NewLocation) && string.IsNullOrEmpty(info.OldLocation))) { throw new Exception("MC:0x00000491");///新旧工位必须同时填写或者同时不填 } return(dal.Add(info)); }