/// <summary> /// 更新物料需求计划和物料需求计划明细信息 /// </summary> /// <param name="model"></param> /// <param name="UpdateID"></param> /// <returns></returns> public static bool UpdateMRPInfo(MRPModel model, Hashtable ht, string UpdateID) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; try { bool succ = false; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(model.MRPNo, 0); logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; succ = MRPDBHelper.UpdateMRPInfo(model, ht, loginUserID, UpdateID); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } LogDBHelper.InsertLog(logModel); return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, 0, ex); return(false); } }
/// <summary> /// 确认或结单 /// </summary> /// <param name="model"></param> /// <param name="isConfirm"></param> /// <returns></returns> public static bool ConfirmOrCompleteMRP(MRPModel model, int OperateType) { string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; //string loginUserID = "admin";//[待修改] return(MRPDBHelper.ConfirmOrCompleteMRP(model, loginUserID, OperateType)); }
/// <summary> /// 物料需求计划明细中是否包含已经生成采购需求的 /// </summary> /// <param name="CompanyCD"></param> /// <param name="strMRPID"></param> /// <returns></returns> public static bool IsHavePurchaseRequire(string CompanyCD, string strMRPID) { try { return(MRPDBHelper.IsHavePurchaseRequire(CompanyCD, strMRPID)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 判断要删除的ID是否已经被引用 /// </summary> /// <param name="CompanyCD"></param> /// <param name="ID"></param> /// <param name="TableName"></param> /// <returns></returns> public static int CountRefrencePurchaseRequire(string CompanyCD, string ID, string TableName) { try { return(MRPDBHelper.CountRefrencePurchaseRequire(CompanyCD, ID, TableName, "MRPCD")); } catch (Exception ex) { throw ex; } }
/// <summary> /// 判断要删除的ID是否已经被引用 /// </summary> /// <param name="CompanyCD"></param> /// <param name="ID"></param> /// <param name="TableName"></param> /// <returns></returns> public static int CountRefrence(string CompanyCD, string ID, string TableName) { try { return(MRPDBHelper.CountRefrence(CompanyCD, ID, TableName, "FromBillNo")); } catch (Exception ex) { throw ex; } }
/// <summary> /// 主生产计划唯一性验证 /// </summary> /// <param name="ParentCode">上级编码</param> /// <returns>大于0:已经有物料需求计划引用该计划了,否则无物料需求计划引用该计划</returns> public static int PlanCount(MRPModel model) { try { return(MRPDBHelper.PlanCount(model)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 物品库存快照 /// </summary> /// <param name="ProductID"></param> /// <param name="CompanyCD"></param> /// <returns></returns> public static DataTable GetProductSnapshot(int ProductID, string CompanyCD) { try { return(MRPDBHelper.GetProductSnapshot(ProductID, CompanyCD)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 可用存量 /// </summary> /// <param name="CompanyCD"></param> /// <param name="ProductID"></param> /// <returns></returns> public static Decimal ProductUseCount(string CompanyCD, int ProductID) { try { return(MRPDBHelper.ProductUseCount(ProductID, CompanyCD)); } catch (Exception ex) { throw ex; } }
/// <summary> /// MRP运算:判断是否有父件等于该ProductID的 /// </summary> /// <param name="CompanyCD"></param> /// <param name="ProductID"></param> /// <returns></returns> public static int HaveBomParentProduct(string CompanyCD, int ProductID) { try { return(MRPDBHelper.HaveBomParentProduct(CompanyCD, ProductID)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据主生产计划单据编号查询主生产计划明细 /// </summary> /// <param name="PlanNo"></param> /// <param name="CompanyCD"></param> /// <returns></returns> public static DataTable GetMasterProductScheduleDetail_ByPlanNo(string PlanNo, string CompanyCD) { try { return(MRPDBHelper.GetMasterProductScheduleDetail_ByPlanNo(PlanNo, CompanyCD)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// MRP运算时,根据父件物品ID,列出所有子件 /// </summary> /// <param name="CompanyCD"></param> /// <param name="ProductID"></param> /// <param name="ProduceCount"></param> /// <returns></returns> public static DataTable MRPCompute_ByParentProduct_GetList(string CompanyCD, int ProductID, Decimal ProduceCount, Decimal ParentProduceCount) { try { return(MRPDBHelper.MRPCompute_ByParentProduct_GetList(CompanyCD, ProductID, ProduceCount, ParentProduceCount)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 查询主生产计划单信息 /// </summary> /// <param name="model">查询条件</param> /// <returns></returns> public static DataTable GetMRPListBycondition(MRPModel model, int FlowStatus, int BillTypeFlag, int BillTypeCode, string EFIndex, string EFDesc, int pageIndex, int pageCount, string OrderBy, ref int totalCount) { try { return(MRPDBHelper.GetMRPListBycondition(model, FlowStatus, BillTypeFlag, BillTypeCode, EFIndex, EFDesc, pageIndex, pageCount, OrderBy, ref totalCount)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// MRP明细信息 /// </summary> /// <returns>DataTable</returns> public static DataTable GetMRPDetailInfo(MRPModel model) { try { return(MRPDBHelper.GetMRPDetailInfo(model)); } catch (System.Exception ex) { throw ex; } }
/// <summary> /// 生成采购需求 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool SendPurchase(string CompanyCD, string MRPID, out string reason) { try { int loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID; return(MRPDBHelper.SendPurchase(CompanyCD, MRPID, loginUserID, out reason)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 删除MRP /// </summary> /// <param name="ID"></param> /// <param name="CompanyCD"></param> /// <returns></returns> public static bool DeleteMRP(string ID, string CompanyCD) { if (string.IsNullOrEmpty(ID)) { return(false); } if (string.IsNullOrEmpty(CompanyCD)) { CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; } UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; bool isSucc = MRPDBHelper.DeleteMRP(ID, CompanyCD); //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //获取删除的编号列表 string[] noList = ID.Split(','); //遍历所有编号,登陆操作日志 for (int i = 0; i < noList.Length; i++) { //获取编号 string no = noList[i]; //替换两边的 ' no = no.Replace("'", string.Empty); //操作日志 LogInfoModel logModel = InitLogInfo("物料需求计划单ID:" + no, 1); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); } return(isSucc); }
/// <summary> /// 取消确认 /// </summary> /// <param name="model"></param> /// <param name="isConfirm"></param> /// <returns></returns> public static bool CancelConfirmMRP(MRPModel model, int BillTypeFlag, int BillTypeCode) { string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; return(MRPDBHelper.CancelConfirmOperate(model, BillTypeFlag, BillTypeCode, loginUserID)); }