/// <summary> /// 保存(传入事务处理) /// </summary> /// <param name="p_Entity"></param> /// <param name="p_BE"></param> /// <param name="sqlTrans"></param> public void RSave(FabricProcess p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans) { try { string sql = "DELETE FROM WO_FabricProcessItemDts WHERE MainID=" + p_Entity.ID.ToString(); sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE)); sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据 for (int i = 0; i < p_BE.Length; i++) { FabricProcessItemDts entitydts = (FabricProcessItemDts)p_BE[i]; if (entitydts.ID != 0)//ID不为0说明数据库中已经存在 { this.RUpdate(entitydts, sqlTrans); } else { entitydts.MainID = p_Entity.ID; this.RAdd(entitydts, sqlTrans); } } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 删除 /// </summary> public override void EntityDelete() { FabricProcessRule rule = new FabricProcessRule(); FabricProcess entity = EntityGet(); rule.RDelete(entity); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { FabricProcess MasterEntity = (FabricProcess)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM WO_FabricProcess WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, 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); if (p_BE3 != null) { FabricProcessItemDtsRule ruleitem = new FabricProcessItemDtsRule(); ruleitem.RSave(entity, p_BE3, 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 RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; PrintingProcessCtl control = new PrintingProcessCtl(sqlTrans); control.Update(entity); FabricProcessDtsRule rule = new FabricProcessDtsRule(); rule.RSave(entity, p_BE2, sqlTrans); //string sql = "DELETE WO_PrintingProcessDts WHERE MainID="+SysString.ToDBString(entity.ID); //sqlTrans.ExecuteNonQuery(sql); //for (int i = 0; i < p_BE2.Length; i++) //{ // FabricProcessDtsRule rule = new FabricProcessDtsRule(); // PrintingProcessDts entityDts = (PrintingProcessDts)p_BE2[i]; // entityDts.MainID = entity.ID; // entityDts.Seq = i + 1; // rule.RAdd(entityDts, sqlTrans); //} //ItemBuyCapDtsRule capRule = new ItemBuyCapDtsRule(); //capRule.RSaveBuyCap(entity, sqlTrans);//保存资金计划明细 } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private FabricProcess EntityGet() { FabricProcess entity = new FabricProcess(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { FabricProcess entity = new FabricProcess(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); HTDataFormNo = entity.FormNo; txtFormNo.Text = entity.FormNo; txtMakeOPName.Text = entity.MakeOPName.ToString(); txtMakeDate.DateTime = entity.MakeDate; txtFormDate.DateTime = entity.FormDate.Date; //drpVendorID.EditValue = entity.VendorID; //drpOrderLevelID.EditValue = entity.OrderLevelID; //drpOrderTypeID.EditValue = entity.OrderTypeID; txtReqDate.DateTime = entity.ReqDate; //txtOrderDate.DateTime = entity.OrderDate; txtOrderFormNo.Text = entity.OrderFormNo; //txtCustomerCode.Text = entity.CustomerCode.ToString(); //txtPayMethodID.Text = entity.PayMethodID.ToString(); txtRemark.Text = entity.Remark.ToString(); //txtContractDesc.Text = entity.ContractDesc.ToString(); txtTotalAmount.Text = entity.TotalAmount.ToString(); txtTotalQty.Text = entity.TotalQty.ToString(); HTDataSubmitFlag = entity.SubmitFlag; HTDataDelFlag = entity.DelFlag; drpPayMothodFlag.EditValue = entity.PayMethodFlag; //drpWLAmountType.EditValue = entity.WLAmountType; //txtWLAmount.Text = entity.WLAmount.ToString(); drpDyeFactorty.EditValue = entity.DyeFactorty.ToString(); //txtRSTec.Text = entity.DyeingTec.ToString(); //txtBuyerReq.Text = entity.DyeingReq.ToString(); //chkLightSource.Text = entity.LightSource.ToString(); //txtSGReq.Text = entity.SGReq.ToString(); //txtSendAddr.Text = entity.SendAddress.ToString(); drpSaleOPID.EditValue = entity.SaleOPID.ToString(); txtGYRequire.Text = entity.GYRequire.ToString(); txtLoss.Text = entity.Loss.ToString(); txtBiLi.Text = entity.BiLi.ToString(); drpYHStyle.EditValue = entity.YHStyle; if (!findFlag) { } BindGridDts(); BindOrderInfo(); BindGridItemDts(); ProductCommon.JGButtonStatusSet(HTFormStatus, HTDataSubmitFlag, HTDataID, btnJGKL);//设置扣料按钮状态 }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { FabricProcess entity = new FabricProcess(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); HTDataFormNo = entity.FormNo; txtFormNo.Text = entity.FormNo; txtMakeOPName.Text = entity.MakeOPName.ToString(); txtMakeDate.DateTime = entity.MakeDate; txtFormDate.DateTime = entity.FormDate.Date; drpVendorID.EditValue = entity.VendorID; drpOrderLevelID.EditValue = entity.OrderLevelID; drpOrderTypeID.EditValue = entity.OrderTypeID; txtReqDate.DateTime = entity.ReqDate; txtOrderDate.DateTime = entity.OrderDate; txtOrderFormNo.Text = entity.OrderFormNo; txtCustomerCode.Text = entity.CustomerCode.ToString(); //txtPayMethodID.Text = entity.PayMethodID.ToString(); txtRemark.Text = entity.Remark.ToString(); txtContractDesc.Text = entity.ContractDesc.ToString(); txtTotalAmount.Text = entity.TotalAmount.ToString(); txtTotalQty.Text = entity.TotalQty.ToString(); HTDataSubmitFlag = entity.SubmitFlag; HTDataDelFlag = entity.DelFlag; drpPayMothodFlag.EditValue = entity.PayMethodFlag; drpWLAmountType.EditValue = entity.WLAmountType; txtWLAmount.Text = entity.WLAmount.ToString(); drpDyeFactorty.EditValue = entity.DyeFactorty.ToString(); txtRSTec.Text = entity.DyeingTec.ToString(); txtBuyerReq.Text = entity.DyeingReq.ToString(); chkLightSource.Text = entity.LightSource.ToString(); txtSGReq.Text = entity.SGReq.ToString(); txtSendAddr.Text = entity.SendAddress.ToString(); drpSaleOPID.EditValue = entity.SaleOPID.ToString(); SetCheckWOOtherType(chklWOOtherTypeIDStr, entity.WOOtherTypeIDStr); txtGongXu.Text = entity.GongXu.ToString(); txtPackMethod.Text = entity.PackMethod.ToString(); drpRCVendorID.EditValue = entity.RCVendorID.ToString(); txtDyeingTec.Text = entity.DyeingTec.ToString(); if (!findFlag) { } BindGridDts(); BindOrderInfo(); }
/// <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); } }
private FabricProcess EntityGet() { FabricProcess entity = new FabricProcess(); entity.ID = HTID; entity.SelectByID(); entity.ProductionID = ID; entity.FormNo = txtFormNo.Text.Trim(); entity.MakeDate = txtMakeDate.DateTime; entity.FormDate = txtFormDate.DateTime.Date; entity.MakeOPID = FParamConfig.LoginID; entity.MakeOPName = txtMakeOPName.Text.Trim(); entity.OrderLevelID = SysConvert.ToInt32(drpOrderLevelID.EditValue); entity.OrderTypeID = SysConvert.ToInt32(drpOrderTypeID.EditValue); entity.VendorID = SysConvert.ToString(drpVendorID.EditValue); entity.OrderFormNo = SysConvert.ToString(txtOrderFormNo.Text.Trim()); //销售合同号 //entity.OrderDate = txtOrderDate.DateTime; entity.ReqDate = txtReqDate.DateTime; //entity.PayMethodID = txtPayMethodID.Text.Trim(); entity.TotalQty = SysConvert.ToDecimal(txtTotalQty.Text.Trim()); entity.TotalAmount = SysConvert.ToDecimal(txtTotalAmount.Text.Trim()); entity.Remark = txtRemark.Text.Trim(); entity.ContractDesc = txtContractDesc.Text.Trim(); entity.CustomerCode = txtCustomerCode.Text.Trim(); entity.PayMethodID = SysConvert.ToString(drpPayMothodFlag.EditValue); entity.PayMethodFlag = SysConvert.ToInt32(drpPayMothodFlag.EditValue); entity.WLAmountType = SysConvert.ToInt32(drpWLAmountType.EditValue); entity.WLAmount = SysConvert.ToDecimal(txtWLAmount.Text.Trim()); entity.DyeFactorty = drpDyeFactorty.EditValue.ToString(); entity.DyeingTec = txtRSTec.Text.Trim(); entity.DyeingReq = txtBuyerReq.Text.Trim(); entity.LightSource = chkLightSource.Text.Trim(); entity.SGReq = txtSGReq.Text.Trim(); entity.SendAddress = txtSendAddr.Text.Trim(); entity.SaleOPID = SysConvert.ToString(drpSaleOPID.EditValue); entity.ProcessTypeID = (int)EnumProcessType.其他加工单; entity.PackMethod = drpPackMethod.Text.ToString(); entity.AfterFinish = drpAfterFinish.Text.ToString(); entity.ShipMethod = SysConvert.ToString(drpShipMethod.EditValue); entity.HZTypeID = SysConvert.ToInt32(drpHZType.EditValue); return(entity); }
private void btnDelete_Click(object sender, EventArgs e) { try { FabricProcessRule rule = new FabricProcessRule(); FabricProcess entity = new FabricProcess(); entity.ID = HTID; entity.SelectByID(); rule.RDelete(entity); this.Close(); } catch (Exception E) { this.ShowMessage(E.Message); } }
public void EntitySet() { FabricProcess entity = new FabricProcess(); entity.ID = HTID; bool findFlag = entity.SelectByID(); txtFormNo.Text = entity.FormNo; txtMakeOPName.Text = entity.MakeOPName.ToString(); txtMakeDate.DateTime = entity.MakeDate; txtFormDate.DateTime = entity.FormDate.Date; drpVendorID.EditValue = entity.VendorID; drpOrderLevelID.EditValue = entity.OrderLevelID; drpOrderTypeID.EditValue = entity.OrderTypeID; txtReqDate.DateTime = entity.ReqDate; txtOrderDate.DateTime = entity.OrderDate; txtOrderFormNo.Text = entity.OrderFormNo; txtCustomerCode.Text = entity.CustomerCode.ToString(); txtRemark.Text = entity.Remark.ToString(); txtContractDesc.Text = entity.ContractDesc.ToString(); txtTotalAmount.Text = entity.TotalAmount.ToString(); txtTotalQty.Text = entity.TotalQty.ToString(); drpPayMothodFlag.EditValue = entity.PayMethodFlag; drpWLAmountType.EditValue = entity.WLAmountType; txtWLAmount.Text = entity.WLAmount.ToString(); drpDyeFactorty.EditValue = entity.DyeFactorty.ToString(); txtRSTec.Text = entity.DyeingTec.ToString(); txtBuyerReq.Text = entity.DyeingReq.ToString(); chkLightSource.Text = entity.LightSource.ToString(); txtSGReq.Text = entity.SGReq.ToString(); txtSendAddr.Text = entity.SendAddress.ToString(); drpSaleOPID.EditValue = entity.SaleOPID.ToString(); drpPackMethod.Text = entity.PackMethod; drpAfterFinish.Text = entity.AfterFinish; drpShipMethod.EditValue = entity.ShipMethod; drpHZType.EditValue = entity.HZTypeID; if (!findFlag) { } BindGridDts(); }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; FabricProcessCtl control = new FabricProcessCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <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("单据状态重复设置,请关闭程序重新打开操作"); } sql = "UPDATE WO_PrintingProcess 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); //if (p_Type == (int)YesOrNo.Yes) //{ // sql = "SELECT ItemCode,ColorNum,ColorName FROM WO_PrintingProcessDts WHERE MainID=" + p_FormID; // DataTable dtDts = sqlTrans.Fill(sql); // SaleOrderRule salerule = new SaleOrderRule(); // foreach (DataRow dr in dtDts.Rows) // { // salerule.RUpdateStep(entity.OrderFormNo, dr["ItemCode"].ToString(), dr["ColorNum"].ToString(),dr["ColorName"].ToString(), (int)EnumOrderStep.采购, p_Type, true, sqlTrans); // } //} } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 修改 /// </summary> public override void EntityUpdate() { FabricProcessRule rule = new FabricProcessRule(); FabricProcess entity = EntityGet(); FabricProcessDts[] entitydts = EntityDtsGet(); decimal totalqty = 0; decimal totalAmount = 0; for (int i = 0; i < entitydts.Length; i++) { totalqty += SysConvert.ToDecimal(entitydts[i].Qty); totalAmount += SysConvert.ToDecimal(entitydts[i].Amount); } entity.TotalQty = totalqty; entity.TotalAmount = totalAmount; entity.SubmitFlag = this.HTSubmitFlagUpdateGet(); rule.RUpdate(entity, entitydts); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; PrintingProcessCtl control = new PrintingProcessCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_PrintingProcess, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, 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); ///回填生产通知单总数量 if (entity.ProductionID != 0) { //sql = "select SUM(ISNULL(TotalQty,0)) TotalQty from WO_FabricProcess where 1=1"; //sql += " AND ProductionID=" + entity.ProductionID; //DataTable dtP = sqlTrans.Fill(sql); //if(dtP.Rows.Count!=0) //{ //} } } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增 /// </summary> public int EntityAdd() { FabricProcessRule rule = new FabricProcessRule(); FabricProcess entity = EntityGet(); FabricProcessDts[] entitydts = EntityDtsGet(); decimal totalqty = 0; decimal totalAmount = 0; for (int i = 0; i < entitydts.Length; i++) { totalqty += SysConvert.ToDecimal(entitydts[i].Qty); totalAmount += SysConvert.ToDecimal(entitydts[i].Amount); } entity.TotalQty = totalqty; entity.TotalAmount = totalAmount; entity.SubmitFlag = 1; rule.RAdd(entity, entitydts); return(entity.ID); }
/// <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> /// <returns></returns> private void EntityProcessGet(FabricProcess p_Entity) { string idStr = string.Empty; string nameStr = string.Empty; for (int i = 0; i < chklWOOtherTypeIDStr.ItemCount; i++) { if (chklWOOtherTypeIDStr.GetItemCheckState(i) == CheckState.Checked) { if (idStr != string.Empty) { idStr += ","; nameStr += ","; } idStr += SysConvert.ToInt32(chklWOOtherTypeIDStr.GetItemValue(i)).ToString(); nameStr += chklWOOtherTypeIDStr.GetItemText(i); } } p_Entity.WOOtherTypeIDStr = idStr; p_Entity.WOOtherTypeNameStr = nameStr; }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); FabricProcess entity = (FabricProcess)p_BE; string sql = "SELECT FormNo FROM WO_PrintingProcess WHERE FormNo=" + SysString.ToDBString(entity.FormNo); DataTable dt = sqlTrans.Fill(sql); if (dt.Rows.Count > 0) { throw new BaseException("印花加工单号已存在,请重新生成"); } PrintingProcessCtl control = new PrintingProcessCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WO_PrintingProcess, sqlTrans); control.AddNew(entity); for (int i = 0; i < p_BE2.Length; i++) { FabricProcessDtsRule rule = new FabricProcessDtsRule(); PrintingProcessDts entityDts = (PrintingProcessDts)p_BE2[i]; entityDts.MainID = entity.ID; entityDts.Seq = i + 1; rule.RAdd(entityDts, sqlTrans); } FormNoControlRule rulest = new FormNoControlRule(); rulest.RAddSort((int)FormNoControlEnum.印花加工单号, sqlTrans); //ItemBuyCapDtsRule capRule = new ItemBuyCapDtsRule(); //capRule.RSaveBuyCap(entity, sqlTrans);//保存资金计划明细 } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private FabricProcess EntityGet() { FabricProcess entity = new FabricProcess(); entity.ID = HTDataID; entity.SelectByID(); entity.FormNo = txtFormNo.Text.Trim(); entity.MakeDate = txtMakeDate.DateTime; entity.FormDate = txtMakeDate.DateTime; entity.MakeOPID = FParamConfig.LoginID; entity.MakeOPName = txtMakeOPName.Text.Trim(); entity.OrderLevelID = SysConvert.ToInt32(drpOrderLevelID.EditValue); entity.OrderTypeID = SysConvert.ToInt32(drpOrderTypeID.EditValue); entity.VendorID = SysConvert.ToString(drpVendorID.EditValue); entity.OrderFormNo = SysConvert.ToString(txtOrderFormNo.Text.Trim()); //销售合同号 //entity.OrderDate = txtOrderDate.DateTime; entity.ReqDate = txtReqDate.DateTime; //entity.PayMethodID = txtPayMethodID.Text.Trim(); entity.TotalQty = SysConvert.ToDecimal(txtTotalQty.Text.Trim()); entity.TotalAmount = SysConvert.ToDecimal(txtTotalAmount.Text.Trim()); entity.Remark = txtRemark.Text.Trim(); entity.ContractDesc = txtContractDesc.Text.Trim(); entity.CustomerCode = txtCustomerCode.Text.Trim(); entity.PayMethodID = SysConvert.ToString(drpPayMothodFlag.EditValue); entity.PayMethodFlag = SysConvert.ToInt32(drpPayMothodFlag.EditValue); entity.WLAmountType = SysConvert.ToInt32(drpWLAmountType.EditValue); entity.WLAmount = SysConvert.ToDecimal(txtWLAmount.Text.Trim()); entity.DyeFactorty = drpDyeFactorty.EditValue.ToString(); //entity.CustomerReq = txtCustomerReq.Text.Trim(); //entity.LossQty = SysConvert.ToDecimal(txtLossQty.Text.Trim()); entity.SendAddress = txtSendAddr.Text.Trim(); entity.SaleOPID = SysConvert.ToString(drpSaleOPID.EditValue); entity.ProcessTypeID = 2; return(entity); }
/// <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> private void CheckCorrect(BaseEntity p_BE) { FabricProcess entity = (FabricProcess)p_BE; }
/// <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> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { FabricProcess MasterEntity = (FabricProcess)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO WO_FabricProcess("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("FormNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ","); MasterField.Append("MakeOPID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPID) + ","); MasterField.Append("MakeOPName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPName) + ","); MasterField.Append("MakeDate" + ","); if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("CheckOPID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CheckOPID) + ","); MasterField.Append("CheckDate" + ","); if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("SubmitFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ","); MasterField.Append("DelFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ","); MasterField.Append("FormDate" + ","); if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("VendorID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ","); MasterField.Append("CustomerCode" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.CustomerCode) + ","); MasterField.Append("OrderTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderTypeID) + ","); MasterField.Append("OrderLevelID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderLevelID) + ","); MasterField.Append("OrderDate" + ","); if (MasterEntity.OrderDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("ReqDate" + ","); if (MasterEntity.ReqDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.ReqDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OrderFormNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderFormNo) + ","); MasterField.Append("Remark" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ","); MasterField.Append("PayMethodID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.PayMethodID) + ","); MasterField.Append("ContractDesc" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ContractDesc) + ","); MasterField.Append("TotalQty" + ","); if (MasterEntity.TotalQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.TotalQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("TotalAmount" + ","); if (MasterEntity.TotalAmount != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.TotalAmount) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OrderPreStepID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderPreStepID) + ","); MasterField.Append("OrderStepID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderStepID) + ","); MasterField.Append("PayMethodFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.PayMethodFlag) + ","); MasterField.Append("StatusFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.StatusFlag) + ","); MasterField.Append("StatusName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.StatusName) + ","); MasterField.Append("WLAmountType" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WLAmountType) + ","); MasterField.Append("WLAmount" + ","); if (MasterEntity.WLAmount != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.WLAmount) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("DyeFactorty" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DyeFactorty) + ","); MasterField.Append("DyeingReq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DyeingReq) + ","); MasterField.Append("SendAddress" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SendAddress) + ","); MasterField.Append("DyeingTec" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DyeingTec) + ","); MasterField.Append("LightSource" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.LightSource) + ","); MasterField.Append("SGReq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SGReq) + ","); MasterField.Append("SaleOPID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SaleOPID) + ","); MasterField.Append("NLQty" + ","); if (MasterEntity.NLQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.NLQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("NLFormDate" + ","); if (MasterEntity.NLFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.NLFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("InQty" + ","); if (MasterEntity.InQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.InQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("InFormDate" + ","); if (MasterEntity.InFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.InFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OutQty" + ","); if (MasterEntity.OutQty != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.OutQty) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("OutFormDate" + ","); if (MasterEntity.OutFormDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.OutFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("JGType" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.JGType) + ","); MasterField.Append("ProcessTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ProcessTypeID) + ","); MasterField.Append("WHOutFormFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WHOutFormFlag) + ","); MasterField.Append("AllItemModel" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.AllItemModel) + ","); MasterField.Append("WOOtherTypeIDStr" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WOOtherTypeIDStr) + ","); MasterField.Append("WOOtherTypeNameStr" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WOOtherTypeNameStr) + ","); MasterField.Append("PackMethod" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.PackMethod) + ","); MasterField.Append("YHStyle" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.YHStyle) + ","); MasterField.Append("GYRequire" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.GYRequire) + ","); MasterField.Append("Loss" + ","); if (MasterEntity.Loss != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.Loss) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("BiLi" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.BiLi) + ","); MasterField.Append("AfterFinish" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.AfterFinish) + ","); MasterField.Append("ShipMethod" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ShipMethod) + ","); MasterField.Append("ProductionID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ProductionID) + ","); MasterField.Append("HZTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.HZTypeID) + ","); MasterField.Append("AuditTime" + ","); if (MasterEntity.AuditTime != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.AuditTime.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("GenDan" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.GenDan) + ","); MasterField.Append("LightSource2" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.LightSource2) + ","); MasterField.Append("LightSource3" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.LightSource3) + ","); MasterField.Append("OrderType" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.OrderType) + ","); MasterField.Append("PriceReportID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.PriceReportID) + ","); MasterField.Append("GongXu" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.GongXu) + ","); MasterField.Append("RCVendorID" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.RCVendorID) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { FabricProcess MasterEntity = (FabricProcess)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE WO_FabricProcess SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ","); UpdateBuilder.Append(" MakeOPID=" + SysString.ToDBString(MasterEntity.MakeOPID) + ","); UpdateBuilder.Append(" MakeOPName=" + SysString.ToDBString(MasterEntity.MakeOPName) + ","); if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" MakeDate=" + SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" MakeDate=null,"); } UpdateBuilder.Append(" CheckOPID=" + SysString.ToDBString(MasterEntity.CheckOPID) + ","); if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" CheckDate=" + SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" CheckDate=null,"); } UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ","); UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag) + ","); if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" FormDate=null,"); } UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ","); UpdateBuilder.Append(" CustomerCode=" + SysString.ToDBString(MasterEntity.CustomerCode) + ","); UpdateBuilder.Append(" OrderTypeID=" + SysString.ToDBString(MasterEntity.OrderTypeID) + ","); UpdateBuilder.Append(" OrderLevelID=" + SysString.ToDBString(MasterEntity.OrderLevelID) + ","); if (MasterEntity.OrderDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" OrderDate=" + SysString.ToDBString(MasterEntity.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" OrderDate=null,"); } if (MasterEntity.ReqDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" ReqDate=" + SysString.ToDBString(MasterEntity.ReqDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" ReqDate=null,"); } UpdateBuilder.Append(" OrderFormNo=" + SysString.ToDBString(MasterEntity.OrderFormNo) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ","); UpdateBuilder.Append(" PayMethodID=" + SysString.ToDBString(MasterEntity.PayMethodID) + ","); UpdateBuilder.Append(" ContractDesc=" + SysString.ToDBString(MasterEntity.ContractDesc) + ","); if (MasterEntity.TotalQty != 0) { UpdateBuilder.Append(" TotalQty=" + SysString.ToDBString(MasterEntity.TotalQty) + ","); } else { UpdateBuilder.Append(" TotalQty=null,"); } if (MasterEntity.TotalAmount != 0) { UpdateBuilder.Append(" TotalAmount=" + SysString.ToDBString(MasterEntity.TotalAmount) + ","); } else { UpdateBuilder.Append(" TotalAmount=null,"); } UpdateBuilder.Append(" OrderPreStepID=" + SysString.ToDBString(MasterEntity.OrderPreStepID) + ","); UpdateBuilder.Append(" OrderStepID=" + SysString.ToDBString(MasterEntity.OrderStepID) + ","); UpdateBuilder.Append(" PayMethodFlag=" + SysString.ToDBString(MasterEntity.PayMethodFlag) + ","); UpdateBuilder.Append(" StatusFlag=" + SysString.ToDBString(MasterEntity.StatusFlag) + ","); UpdateBuilder.Append(" StatusName=" + SysString.ToDBString(MasterEntity.StatusName) + ","); UpdateBuilder.Append(" WLAmountType=" + SysString.ToDBString(MasterEntity.WLAmountType) + ","); if (MasterEntity.WLAmount != 0) { UpdateBuilder.Append(" WLAmount=" + SysString.ToDBString(MasterEntity.WLAmount) + ","); } else { UpdateBuilder.Append(" WLAmount=null,"); } UpdateBuilder.Append(" DyeFactorty=" + SysString.ToDBString(MasterEntity.DyeFactorty) + ","); UpdateBuilder.Append(" DyeingReq=" + SysString.ToDBString(MasterEntity.DyeingReq) + ","); UpdateBuilder.Append(" SendAddress=" + SysString.ToDBString(MasterEntity.SendAddress) + ","); UpdateBuilder.Append(" DyeingTec=" + SysString.ToDBString(MasterEntity.DyeingTec) + ","); UpdateBuilder.Append(" LightSource=" + SysString.ToDBString(MasterEntity.LightSource) + ","); UpdateBuilder.Append(" SGReq=" + SysString.ToDBString(MasterEntity.SGReq) + ","); UpdateBuilder.Append(" SaleOPID=" + SysString.ToDBString(MasterEntity.SaleOPID) + ","); if (MasterEntity.NLQty != 0) { UpdateBuilder.Append(" NLQty=" + SysString.ToDBString(MasterEntity.NLQty) + ","); } else { UpdateBuilder.Append(" NLQty=null,"); } if (MasterEntity.NLFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" NLFormDate=" + SysString.ToDBString(MasterEntity.NLFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" NLFormDate=null,"); } if (MasterEntity.InQty != 0) { UpdateBuilder.Append(" InQty=" + SysString.ToDBString(MasterEntity.InQty) + ","); } else { UpdateBuilder.Append(" InQty=null,"); } if (MasterEntity.InFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" InFormDate=" + SysString.ToDBString(MasterEntity.InFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" InFormDate=null,"); } if (MasterEntity.OutQty != 0) { UpdateBuilder.Append(" OutQty=" + SysString.ToDBString(MasterEntity.OutQty) + ","); } else { UpdateBuilder.Append(" OutQty=null,"); } if (MasterEntity.OutFormDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" OutFormDate=" + SysString.ToDBString(MasterEntity.OutFormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" OutFormDate=null,"); } UpdateBuilder.Append(" JGType=" + SysString.ToDBString(MasterEntity.JGType) + ","); UpdateBuilder.Append(" ProcessTypeID=" + SysString.ToDBString(MasterEntity.ProcessTypeID) + ","); UpdateBuilder.Append(" WHOutFormFlag=" + SysString.ToDBString(MasterEntity.WHOutFormFlag) + ","); UpdateBuilder.Append(" AllItemModel=" + SysString.ToDBString(MasterEntity.AllItemModel) + ","); UpdateBuilder.Append(" WOOtherTypeIDStr=" + SysString.ToDBString(MasterEntity.WOOtherTypeIDStr) + ","); UpdateBuilder.Append(" WOOtherTypeNameStr=" + SysString.ToDBString(MasterEntity.WOOtherTypeNameStr) + ","); UpdateBuilder.Append(" PackMethod=" + SysString.ToDBString(MasterEntity.PackMethod) + ","); UpdateBuilder.Append(" YHStyle=" + SysString.ToDBString(MasterEntity.YHStyle) + ","); UpdateBuilder.Append(" GYRequire=" + SysString.ToDBString(MasterEntity.GYRequire) + ","); if (MasterEntity.Loss != 0) { UpdateBuilder.Append(" Loss=" + SysString.ToDBString(MasterEntity.Loss) + ","); } else { UpdateBuilder.Append(" Loss=null,"); } UpdateBuilder.Append(" BiLi=" + SysString.ToDBString(MasterEntity.BiLi) + ","); UpdateBuilder.Append(" AfterFinish=" + SysString.ToDBString(MasterEntity.AfterFinish) + ","); UpdateBuilder.Append(" ShipMethod=" + SysString.ToDBString(MasterEntity.ShipMethod) + ","); UpdateBuilder.Append(" ProductionID=" + SysString.ToDBString(MasterEntity.ProductionID) + ","); UpdateBuilder.Append(" HZTypeID=" + SysString.ToDBString(MasterEntity.HZTypeID) + ","); if (MasterEntity.AuditTime != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" AuditTime=" + SysString.ToDBString(MasterEntity.AuditTime.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" AuditTime=null,"); } UpdateBuilder.Append(" GenDan=" + SysString.ToDBString(MasterEntity.GenDan) + ","); UpdateBuilder.Append(" LightSource2=" + SysString.ToDBString(MasterEntity.LightSource2) + ","); UpdateBuilder.Append(" LightSource3=" + SysString.ToDBString(MasterEntity.LightSource3) + ","); UpdateBuilder.Append(" OrderType=" + SysString.ToDBString(MasterEntity.OrderType) + ","); UpdateBuilder.Append(" PriceReportID=" + SysString.ToDBString(MasterEntity.PriceReportID) + ","); UpdateBuilder.Append(" GongXu=" + SysString.ToDBString(MasterEntity.GongXu) + ","); UpdateBuilder.Append(" RCVendorID=" + SysString.ToDBString(MasterEntity.RCVendorID)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
/// <summary> /// 创建单据 /// </summary> /// <param name="entity"></param> /// <param name="sqlTrans"></param> /// <returns></returns> IOForm RAutoCreateWHForm(FabricWHOutForm entity, IDBTransAccess sqlTrans) { IOForm entitywh = new IOForm(sqlTrans); FabricProcess entityjg = new FabricProcess(sqlTrans); entityjg.ID = entity.MainID; entityjg.SelectByID(); #region 赋值出入库单据主实体 /*赋值出入库单据主实体 Begin*/ SaleProcedureRule rulesalePro = new SaleProcedureRule(); int saleProcedureID = rulesalePro.GetSaleProcedureByWOTypeID(entityjg.ProcessTypeID);//加工业务单据类型ID string sql = string.Empty; sql = "SELECT JGFormListID FROM Enum_SaleProcedure WHERE ID=" + saleProcedureID; DataTable dtSalePro = sqlTrans.Fill(sql);//配置表 if (dtSalePro.Rows.Count != 0) { entitywh.SubType = SysConvert.ToInt32(dtSalePro.Rows[0]["JGFormListID"]); FormListRule ruleformlist = new FormListRule(); entitywh.HeadType = ruleformlist.GetFormListIDBySubTypeID(entitywh.SubType, sqlTrans); } else { throw new Exception("业务单据类型配置异常"); } entitywh.WHID = entity.WHID; entitywh.WHOP = ParamConfig.LoginName; entitywh.VendorID = entityjg.DyeFactorty;//加工厂 entitywh.FormDate = DateTime.Now.Date; entitywh.WHType = entity.WHID; entitywh.SpecialNo = entity.FormNo;//源单据号;自动扣料的单据号 FormNoControlRule formconrule = new FormNoControlRule(); entitywh.FormNo = formconrule.RGetWHFormNo(entitywh.SubType, "", sqlTrans); /*赋值出入库单据主实体End */ #endregion #region 赋值出入库单据明细实体 /*赋值出入库单据明细实体 Begin*/ sql = "SELECT * FROM WO_FabricWHOutFormDts WHERE MainID=" + entity.ID; DataTable dtDts = sqlTrans.Fill(sql); IOFormDts[] entityDtswh = new IOFormDts[dtDts.Rows.Count]; if (dtDts.Rows.Count == 0) { throw new Exception("没有数据明细,不应进行数据保存"); } for (int i = 0; i < dtDts.Rows.Count; i++) { entityDtswh[i] = new IOFormDts(); entityDtswh[i].Seq = i + 1; entityDtswh[i].WHID = dtDts.Rows[i]["WHID"].ToString(); entityDtswh[i].SectionID = dtDts.Rows[i]["SectionID"].ToString(); entityDtswh[i].SBitID = dtDts.Rows[i]["SBitID"].ToString(); entityDtswh[i].ItemCode = dtDts.Rows[i]["ItemCode"].ToString(); entityDtswh[i].ItemName = dtDts.Rows[i]["ItemName"].ToString(); entityDtswh[i].ItemStd = dtDts.Rows[i]["ItemStd"].ToString(); entityDtswh[i].ItemModel = dtDts.Rows[i]["ItemModel"].ToString(); entityDtswh[i].Batch = dtDts.Rows[i]["Batch"].ToString(); entityDtswh[i].VendorBatch = dtDts.Rows[i]["VendorBatch"].ToString(); entityDtswh[i].ColorNum = dtDts.Rows[i]["ColorNum"].ToString(); entityDtswh[i].ColorName = dtDts.Rows[i]["ColorName"].ToString(); entityDtswh[i].JarNum = dtDts.Rows[i]["JarNum"].ToString(); entityDtswh[i].PieceQty = SysConvert.ToInt32(dtDts.Rows[i]["PieceQty"]); entityDtswh[i].Remark = dtDts.Rows[i]["Remark"].ToString(); entityDtswh[i].Qty = SysConvert.ToDecimal(dtDts.Rows[i]["Qty"]); entityDtswh[i].Unit = dtDts.Rows[i]["Unit"].ToString(); entityDtswh[i].Weight = SysConvert.ToDecimal(dtDts.Rows[i]["Weight"]); entityDtswh[i].SinglePrice = SysConvert.ToDecimal(dtDts.Rows[i]["SinglePrice"]); entityDtswh[i].DYPrice = SysConvert.ToDecimal(dtDts.Rows[i]["DYPrice"]); entityDtswh[i].Amount = SysConvert.ToDecimal(dtDts.Rows[i]["Amount"]); entityDtswh[i].GoodsCode = dtDts.Rows[i]["GoodsCode"].ToString(); entityDtswh[i].GoodsLevel = dtDts.Rows[i]["GoodsLevel"].ToString(); entityDtswh[i].VColorNum = dtDts.Rows[i]["VColorNum"].ToString(); entityDtswh[i].VColorName = dtDts.Rows[i]["VColorName"].ToString(); entityDtswh[i].VItemCode = dtDts.Rows[i]["VItemCode"].ToString(); entityDtswh[i].MWeight = dtDts.Rows[i]["MWeight"].ToString(); entityDtswh[i].MWidth = dtDts.Rows[i]["MWidth"].ToString(); entityDtswh[i].WeightUnit = dtDts.Rows[i]["WeightUnit"].ToString(); entityDtswh[i].PackDts = dtDts.Rows[i]["PackDts"].ToString(); //entityDtswh[i].DtsSO = dtDts.Rows[i]["DtsSO"].ToString(); //entityDtswh[i].DtsOrderFormNo = dtDts.Rows[i]["DtsOrderFormNo"].ToString(); entityDtswh[i].DtsInVendorID = dtDts.Rows[i]["DtsInVendorID"].ToString(); entityDtswh[i].InSO = dtDts.Rows[i]["InSO"].ToString(); entityDtswh[i].InOrderFormNo = dtDts.Rows[i]["InOrderFormNo"].ToString(); entityDtswh[i].InSaleOPID = dtDts.Rows[i]["InSaleOPID"].ToString(); entityDtswh[i].MLType = SysConvert.ToInt32(dtDts.Rows[i]["MLType"]); //entityDtswh[i].LoadDtsID = SysConvert.ToInt32(dtDts.Rows[i]["LoadDtsID"]); entityDtswh[i].LoadDtsID = SysConvert.ToInt32(dtDts.Rows[i]["ID"]); //明细表ID entityDtswh[i].DtsSO = entityjg.FormNo; //关联单据 entityDtswh[i].DtsOrderFormNo = dtDts.Rows[i]["DtsSO"].ToString(); //订单号 } decimal TotalQty = 0; decimal TotalAmount = 0; for (int i = 0; i < entityDtswh.Length; i++) { TotalQty += SysConvert.ToDecimal(entityDtswh[i].Qty); TotalAmount += SysConvert.ToDecimal(entityDtswh[i].Amount); } entitywh.TotalQty = TotalQty; entitywh.TotalAmount = TotalAmount; /*赋值出入库单据明细实体 End*/ #endregion IOFormRule rulewh = new IOFormRule(); rulewh.RAdd(entitywh, entityDtswh, sqlTrans);//保存主从数据 #region 保存孙表数据 /*赋值出入库单据码单明细数据 Begin*/ sql = "SELECT TOP 1 ID FROM WO_FabricWHOutFormDtsPack WHERE MainID=" + SysString.ToDBString(entity.ID); DataTable dtPackCheck = sqlTrans.Fill(sql); if (dtPackCheck.Rows.Count != 0)//如果有码单明细表示需要保存码单明细值 { sql = "SELECT LoadDtsID,ID,Seq FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entitywh.ID); dtPackCheck = sqlTrans.Fill(sql); for (int i = 0; i < dtPackCheck.Rows.Count; i++) { int LoadDtsID = SysConvert.ToInt32(dtPackCheck.Rows[i]["LoadDtsID"]); int Seq = SysConvert.ToInt32(dtPackCheck.Rows[i]["Seq"]); int ID = SysConvert.ToInt32(dtPackCheck.Rows[i]["ID"]); int SubSeq = 1; if (LoadDtsID > 0) { sql = "SELECT * FROM WO_FabricWHOutFormDtsPack WHERE DID=" + SysString.ToDBString(LoadDtsID); DataTable dtfh = sqlTrans.Fill(sql); for (int j = 0; j < dtfh.Rows.Count; j++) { IOFormDtsPackRule rulePack = new IOFormDtsPackRule(); IOFormDtsPack entityPack = new IOFormDtsPack(); entityPack.MainID = entitywh.ID; entityPack.Seq = Seq; entityPack.DID = ID; entityPack.SubSeq = SubSeq; entityPack.BoxNo = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]); entityPack.Remark = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]); entityPack.Qty = SysConvert.ToDecimal(dtfh.Rows[j]["Qty"]); SubSeq++; rulePack.RAdd(entityPack, sqlTrans); } } } } /*赋值出入库单据码单明细数据 End*/ #endregion rulewh.RSubmit(entitywh.ID, (int)YesOrNo.Yes, sqlTrans);//提交 return(entitywh); }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { FabricProcess entity = new FabricProcess(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); HTDataFormNo = entity.FormNo; txtFormNo.Text = entity.FormNo; txtMakeOPName.Text = entity.MakeOPName.ToString(); txtMakeDate.DateTime = entity.MakeDate; txtFormDate.DateTime = entity.FormDate.Date; drpVendorID.EditValue = entity.VendorID; drpOrderLevelID.EditValue = entity.OrderLevelID; drpOrderTypeID.EditValue = entity.OrderTypeID; txtReqDate.DateTime = entity.ReqDate; txtOrderDate.DateTime = entity.OrderDate; txtOrderFormNo.Text = entity.OrderFormNo; txtCustomerCode.Text = entity.CustomerCode.ToString(); //txtPayMethodID.Text = entity.PayMethodID.ToString(); txtRemark.Text = entity.Remark.ToString(); txtContractDesc.Text = entity.ContractDesc.ToString(); txtTotalAmount.Text = entity.TotalAmount.ToString(); txtTotalQty.Text = entity.TotalQty.ToString(); HTDataSubmitFlag = entity.SubmitFlag; HTDataDelFlag = entity.DelFlag; drpPayMothodFlag.EditValue = entity.PayMethodFlag; drpWLAmountType.EditValue = entity.WLAmountType; txtWLAmount.Text = entity.WLAmount.ToString(); drpDyeFactorty.EditValue = entity.DyeFactorty.ToString(); txtRSTec.Text = entity.DyeingTec.ToString(); txtBuyerReq.Text = entity.DyeingReq.ToString(); chkLightSource.Text = entity.LightSource.ToString(); txtSGReq.Text = entity.SGReq.ToString(); txtSendAddr.Text = entity.SendAddress.ToString(); drpSaleOPID.EditValue = entity.SaleOPID.ToString(); drpPackMethod.Text = entity.PackMethod; drpAfterFinish.Text = entity.AfterFinish; drpShipMethod.EditValue = entity.ShipMethod; if (!findFlag) { } FabricProcessAdd entityAdd = new FabricProcessAdd(); entityAdd.ID = HTDataID; entityAdd.SelectByID(); txtASigned.Text = entityAdd.Signed; txtADesizing.Text = entityAdd.Desizing; txtAMercerized.Text = entityAdd.Mercerized; txtAReactive.Text = entityAdd.Reactive; txtAPigment.Text = entityAdd.Pigment; txtANonAzo.Text = entityAdd.NonAzo; txtASoftner.Text = entityAdd.Softner; txtAStentering.Text = entityAdd.Stentering; txtASanfor.Text = entityAdd.Sanfor; txtAWaterwash.Text = entityAdd.Waterwash; txtAAirowash.Text = entityAdd.Airowash; txtACarbonpeach.Text = entityAdd.Carbonpeach; txtAMoleskin.Text = entityAdd.Moleskin; txtPHValue.Text = entityAdd.PHValue; txtSL.Text = entityAdd.SL; txtGC.Text = entityAdd.GC; txtSC.Text = entityAdd.SC; txtLight.Text = entityAdd.Light; txtXSHZSLD.Text = entityAdd.XSHZSLD; txtPillingMartindale.Text = entityAdd.PillingMartindale; txtDSGY1.Text = entityAdd.DSGY1; txtDSGY2.Text = entityAdd.DSGY2; txtDSGY3.Text = entityAdd.DSGY3; txtDSGY4.Text = entityAdd.DSGY4; txtDSGY5.Text = entityAdd.DSGY5; txtTensileStrength.Text = entityAdd.TensileStrength; txtTearingStrength.Text = entityAdd.TearingStrength; txtSeamSlippage.Text = entityAdd.SeamSlippage.ToString(); txtXSLD.Text = entityAdd.XSLD; txtXDLD.Text = entityAdd.XDLD; txtWX.Text = entityAdd.WX; txtShipmentSample.Text = entityAdd.ShipmentSample; txtApprovedLab.Text = entityAdd.ApprovedLab; txtHandFeelSample.Text = entityAdd.HandFeelSample; txtSmooth.Text = entityAdd.Smooth; txtRough.Text = entityAdd.Rough; txtRolledOnTube.Text = entityAdd.RolledOnTube; txtPolyBagWrapped.Text = entityAdd.PolyBagWrapped; txtYardFolded.Text = entityAdd.YardFolded; txtDoublePolyBagWrapped.Text = entityAdd.DoublePolyBagWrapped; txtCartonPack.Text = entityAdd.Carbonpeach; txtForBales.Text = entityAdd.ForBales; BindGridDts(); BindOrderInfo(); BindGridPBDts(); }