/// <summary> /// 构造函数 /// </summary> public CDGLCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public FabricProcessDtsCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public Fabric(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity p_BEAdd, BaseEntity[] p_BE2, BaseEntity[] p_BE3, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; FabricProcessCtl control = new FabricProcessCtl(sqlTrans); string sql = "SELECT FormNo FROM WO_FabricProcess WHERE FormNo=" + SysString.ToDBString(entity.FormNo); DataTable dt = sqlTrans.Fill(sql); if (dt.Rows.Count > 0) { throw new BaseException("单号已存在,请重新生成"); } entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_FabricProcess, sqlTrans); control.AddNew(entity); FormNoControlRule fnrule = new FormNoControlRule(); fnrule.RAddSort("WO_FabricProcess", "FormNo", entity.ProcessTypeID, sqlTrans); FabricProcessAddRule ruleAdd = new FabricProcessAddRule(); FabricProcessAdd entityAdd = (FabricProcessAdd)p_BEAdd; entityAdd.ID = entity.ID; ruleAdd.RAdd(entityAdd, sqlTrans); for (int i = 0; i < p_BE2.Length; i++) { FabricProcessDtsRule rule = new FabricProcessDtsRule(); FabricProcessDts entityDts = (FabricProcessDts)p_BE2[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } for (int i = 0; i < p_BE3.Length; i++) { FabricProcessPBDtsRule rule = new FabricProcessPBDtsRule(); FabricProcessPBDts entityDts = (FabricProcessPBDts)p_BE3[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 构造函数 /// </summary> public GBJCLRDtsCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public Exceptional(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 审核 /// </summary> /// <param name="p_FormID">单据ID</param> /// <param name="p_Type">0/1/2/3:弃审/审核</param> public void RSubmit(int p_FormID, int p_Type, IDBTransAccess sqlTrans) { try { int p_TempType = p_Type;//处理状态 string sql = string.Empty; FabricProcess entity = new FabricProcess(sqlTrans); entity.ID = p_FormID; entity.SelectByID(); if (entity.SubmitFlag == p_Type)//如果相同异常 { throw new Exception("单据状态重复设置,请关闭程序重新打开操作"); } if (p_Type == (int)ConfirmFlag.未提交) //撤销提交验证 { if (SysConvert.ToBoolean(ProductParamSet.GetIntValueByID(5809))) //加工单有仓库单据不允许修改 { bool allowOPFlag = true; string refuseMessage = string.Empty; DataTable dtSOFlow; if (allowOPFlag) { //仓库流程单据 sql = "SELECT TOP 1 ID,FormNo FROM UV1_WH_IOFormDts WHERE DtsSO=" + SysString.ToDBString(entity.FormNo); dtSOFlow = SysUtils.Fill(sql); if (dtSOFlow.Rows.Count != 0) { allowOPFlag = false; refuseMessage = "此单已有仓库单据(单号):" + dtSOFlow.Rows[0]["FormNo"].ToString() + ",不允许撤销"; } } if (!allowOPFlag)//不允许操作 { throw new Exception(refuseMessage); } } } sql = "UPDATE WO_FabricProcess SET SubmitFlag=" + SysString.ToDBString(p_Type); //if (p_Type == (int)ConfirmFlag.审核通过 || p_Type == (int)ConfirmFlag.审核拒绝) //{ //sql += ",SubmitOPID=" + SysString.ToDBString(ParamConfig.LoginName) + ",SubmitTime=" + SysString.ToDBString(DateTime.Now); //} sql += " WHERE ID=" + p_FormID.ToString();//更新单据主表审核状态 sqlTrans.ExecuteNonQuery(sql); int tempSaleProcedureID = 0; switch (entity.ProcessTypeID)//2:织造;1:染整;3:印花;4:其它 { case 1: tempSaleProcedureID = (int)EnumSaleProcedure.染整加工单; break; case 2: tempSaleProcedureID = (int)EnumSaleProcedure.织胚加工单; //织造加工单 break; case 3: tempSaleProcedureID = (int)EnumSaleProcedure.印花加工单; break; case 4: //其它 改为后整加工 tempSaleProcedureID = (int)EnumSaleProcedure.其它加工单; break; case 5: tempSaleProcedureID = (int)EnumSaleProcedure.合加工单; break; } //if (p_Type == (int)YesOrNo.Yes) if (p_Type == (int)ConfirmFlag.已提交) { sql = "SELECT DtsSO,ItemCode,ColorNum,ColorName,DtsSO,CPItemCode FROM WO_FabricProcessDts WHERE MainID=" + p_FormID; DataTable dtDts = sqlTrans.Fill(sql); if (tempSaleProcedureID == (int)EnumSaleProcedure.织胚加工单)//织造加工单 { SaleOrderRule salerule = new SaleOrderRule(); foreach (DataRow dr in dtDts.Rows) { salerule.RUpdateStep(dr["DtsSO"].ToString(), dr["CPItemCode"].ToString(), dr["ColorNum"].ToString(), dr["ColorName"].ToString(), tempSaleProcedureID, 0, 0, 0, p_Type, true, sqlTrans); } } else { SaleOrderRule salerule = new SaleOrderRule(); foreach (DataRow dr in dtDts.Rows) { salerule.RUpdateStep(dr["DtsSO"].ToString(), dr["ItemCode"].ToString(), dr["ColorNum"].ToString(), dr["ColorName"].ToString(), tempSaleProcedureID, 0, 0, 0, p_Type, true, sqlTrans); } } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 锁定库存(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RLock(BaseEntity p_BE, bool p_CheckLockNum, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); StorgeLock entity = (StorgeLock)p_BE; string sql = string.Empty; //DataTable dt; //if (p_CheckLockNum)//校验是否超过最大锁定次数 //{ // ParamSetRule ruleparam = new ParamSetRule(); // sql = "SELECT COUNT(*) FROM WH_StorgeLockHis WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode); // sql += " AND LockOPID=" + SysString.ToDBString(entity.LockOPID); // sql += " AND LockTime BETWEEN " + SysString.ToDBString(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-1"); // sql += " AND " + SysString.ToDBString(DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month).ToString()); // dt = sqlTrans.Fill(sql); // if (SysConvert.ToInt32(dt.Rows[0][0]) >= ruleparam.RShowInt((int)ParamSet.锁定次数)) // { // throw new Exception("纱种:" + entity.ItemName + " 本月已达到最大锁定次数" + dt.Rows[0][0].ToString() + ",锁定失败"); // } //} StorgeLockHisRule rule = new StorgeLockHisRule(); StorgeLockHis entityhis = new StorgeLockHis(sqlTrans); entityhis.ID = entity.ID; entityhis.WHID = entity.WHID; //entityhis.StorgeID = entity.StorgeID; entityhis.ItemCode = entity.ItemCode; entityhis.ItemName = entity.ItemName; entityhis.ItemStd = entity.ItemStd; entityhis.LockDesc = entity.Remark; entityhis.LockOPID = entity.LockOPID; //entityhis.LockQty = entity.LockQty; entityhis.LockSO = entity.LockSO; entityhis.LockTime = entity.LockTime; entityhis.NeedDate = entity.NeedDate; entityhis.Batch = entity.Batch; entityhis.VendorBatch = entity.VendorBatch; entityhis.ColorName = entity.ColorName; entityhis.ColorNum = entity.ColorNum; entityhis.JarNum = entity.JarNum; //entityhis.WHTypeID = entity.WHTypeID; //entityhis.LockTypeID = (int)LockType.锁定; entity.LastUpdOP = ParamConfig.LoginName; entity.LastUpdTime = DateTime.Now; this.RAdd(entity, sqlTrans); //更新库存 StorgeRule rules = new StorgeRule(); // rules.UpdateStorge(entity.StorgeID, SysConvert.ToFloat(entity.LockQty), true, sqlTrans); //新增锁定历史数据 rule.RAdd(entityhis, sqlTrans); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 解锁 /// </summary> /// <param name="p_StorgeLockID">锁定记录ID</param> /// <param name="sqlTrans">事务类</param> public void RUnLock(int p_StorgeLockID, decimal p_UnLockQty, string p_Remark, bool p_AboveFlag, IDBTransAccess sqlTrans) { try { StorgeLock entity = new StorgeLock(sqlTrans); entity.ID = p_StorgeLockID; entity.SelectByID(); StorgeLockHisRule rule = new StorgeLockHisRule(); StorgeLockHis entityhis = new StorgeLockHis(sqlTrans); //entityhis.StorgeID = p_StorgeLockID; //entityhis.LockStorgeID = p_StorgeLockID; entityhis.ID = entity.ID; entityhis.WHID = entity.WHID; // entityhis.StorgeID = entity.StorgeID; entityhis.ItemCode = entity.ItemCode; entityhis.ItemName = entity.ItemName; entityhis.ItemStd = entity.ItemStd; entityhis.LockOPID = entity.LockOPID; //entityhis.LockQty = entity.LockQty; entityhis.LockSO = entity.LockSO; entityhis.Batch = entity.Batch; entityhis.VendorBatch = entity.VendorBatch; entityhis.ColorName = entity.ColorName; entityhis.ColorNum = entity.ColorNum; entityhis.JarNum = entity.JarNum; entityhis.VendorBatch = entity.VendorBatch; entityhis.LockTime = entity.LockTime; entityhis.NeedDate = entity.NeedDate; entityhis.LockDesc = entity.Remark; //entityhis.LockTypeID = (int)LockType.解除锁定; //entityhis.LockQty = p_UnLockQty; //entityhis.UnLockQty = p_UnLockQty; //entityhis.UnlockOPID = ParamConfig.LoginID; //entityhis.UnlockTime = DateTime.Now; //entityhis.UnlockDesc = p_Remark; entityhis.Remark = p_Remark; entityhis.LastUpdOP = ParamConfig.LoginName; entityhis.LastUpdTime = DateTime.Now; if (p_UnLockQty >= entity.LockQty)//已经全部解锁 { if (p_AboveFlag && (p_UnLockQty > entity.LockQty)) { throw new Exception("解锁数量:" + p_UnLockQty.ToString() + " 大于当前锁定数量:" + entity.LockQty.ToString() + ",解锁失败"); } this.RDelete(entity, sqlTrans); StorgeRule rules = new StorgeRule(); // rules.UpdateStorge(entity.StorgeID, SysConvert.ToFloat(entity.LockQty), false, sqlTrans); } else//未全部解锁 { entity.LockQty = entity.LockQty - p_UnLockQty; entity.LastUpdOP = ParamConfig.LoginName; entity.LastUpdTime = DateTime.Now.Date; this.RUpdate(entity, sqlTrans); StorgeRule rules = new StorgeRule(); //rules.UpdateStorge(entity.StorgeID, SysConvert.ToFloat(p_UnLockQty), false, sqlTrans); } rule.RAdd(entityhis, sqlTrans);//新增解锁历史记录 } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 构造函数 /// </summary> public ItemType(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public ExpressDtsCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public VendorTypeFormCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public UploadPicProp(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public RecPayHXDtsCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public ItemBuyFollowCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public OrderProgressDts(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public WHCaiWuTypeCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public CheckOrderISNFault(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public FormItemMoreCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public MSGSource(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, BaseEntity[] p_BE3, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; this.RAdd(entity, sqlTrans); //string sql = "SELECT FormNo FROM WO_FabricProcess WHERE FormNo=" + SysString.ToDBString(entity.FormNo); //DataTable dt = sqlTrans.Fill(sql); //if (dt.Rows.Count > 0) //{ // throw new BaseException("染布加工单号已存在,请重新生成"); //} //FabricProcessCtl control = new FabricProcessCtl(sqlTrans); //entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_FabricProcess, sqlTrans); //control.AddNew(entity); for (int i = 0; i < p_BE2.Length; i++) { FabricProcessDtsRule rule = new FabricProcessDtsRule(); FabricProcessDts entityDts = (FabricProcessDts)p_BE2[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } if (p_BE3 != null) { for (int i = 0; i < p_BE3.Length; i++) { FabricProcessItemDtsRule rule = new FabricProcessItemDtsRule(); FabricProcessItemDts entityItemfac = (FabricProcessItemDts)p_BE3[i]; entityItemfac.MainID = entity.ID; entityItemfac.Seq = i + 1; rule.RAdd(entityItemfac, sqlTrans); } } //FormNoControlRule frule = new FormNoControlRule(); //if (entity.ProcessTypeID == (int)EnumProcessType.染整加工单) //{ // frule.RAddSort((int)FormNoControlEnum.染布加工单号,sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.印花加工单) //{ // frule.RAddSort((int)FormNoControlEnum.印花加工单号, sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.织造加工单) //{ // frule.RAddSort((int)FormNoControlEnum.织造加工单号, sqlTrans); //} //if (entity.ProcessTypeID == (int)EnumProcessType.其他加工单) //{ // frule.RAddSort((int)FormNoControlEnum.其他加工单号, sqlTrans); //} } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 构造函数 /// </summary> public Structure(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, BaseEntity p_BEAdd, BaseEntity[] p_BE2, BaseEntity[] p_BE3, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; FabricProcessCtl control = new FabricProcessCtl(sqlTrans); control.Update(entity); FabricProcessDtsRule rule = new FabricProcessDtsRule(); rule.RSave(entity, p_BE2, sqlTrans); string sql = "DELETE WO_FabricProcessAdd WHERE ID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); sql = "DELETE WO_FabricProcessPBDts WHERE MainID=" + SysString.ToDBString(entity.ID); sqlTrans.ExecuteNonQuery(sql); FabricProcessAddRule ruleAdd = new FabricProcessAddRule(); FabricProcessAdd entityAdd = (FabricProcessAdd)p_BEAdd; entityAdd.ID = entity.ID; ruleAdd.RAdd(entityAdd, sqlTrans); for (int i = 0; i < p_BE3.Length; i++) { FabricProcessPBDtsRule rule2 = new FabricProcessPBDtsRule(); FabricProcessPBDts entityDts = (FabricProcessPBDts)p_BE3[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule2.RAdd(entityDts, sqlTrans); } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 构造函数 /// </summary> public ProductionPlanDtsCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public DaoTongDts(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public UpdateWHSinglePrice(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public StorgeAlarmCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 构造函数 /// </summary> public FormNCVendor(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }
/// <summary> /// 检验字段值是否已存在 /// </summary> /// <param name="p_TableName">表名</param> /// <param name="p_FieldName">字段名</param> /// <param name="p_FieldValue">字段值</param> /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param> /// <param name="p_KeyValue">主键值</param> /// <param name="p_sqlTrans"></param> /// <returns></returns> private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans) { QS entity = (QS)p_BE; bool ret = false; string sql = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, QS.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID); DataTable dt = p_sqlTrans.Fill(sql); if (dt.Rows.Count != 0) { ret = true; } return(ret); }
/// <summary> /// 构造函数 /// </summary> public RequestTypeCtl(IDBTransAccess p_SqlCmd) { sqlTrans = p_SqlCmd; sqlTransFlag = true; }