public UCSaleOrderView(string sale_order_id, string order_status, UCSaleOrderManager uc) { InitializeComponent(); this.uc = uc; this.SaleorderId = sale_order_id; base.SetBaseButtonStatus(); if (uc != null) { base.SetButtonVisiableView(); base.btnSave.Visible = true; } string[] NotReadOnlyColumnsName = new string[] { "colCheck", "is_suspend" }; CommonFuncCall.SetColumnReadOnly(gvPurchaseList, NotReadOnlyColumnsName); //当采购订单状态是已审核时才可以中止,否则不可以中止 DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(order_status); if (enumDataSources != DataSources.EnumAuditStatus.AUDIT) { chkis_suspend.Enabled = false; is_suspend.ReadOnly = true; } //CommonFuncCall.BindUnit(unit_id); LoadInfo(sale_order_id); GetAccessories(sale_order_id); base.SaveEvent += new ClickHandler(UCSaleOrderView_SaveEvent); }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 if (!CheckControlValue()) { return; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List <SQLObj> listSql = new List <SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql, strId); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); isAutoClose = true; deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnOK_Click(object sender, EventArgs e) { Content = !rtbContent.Text.Trim().Contains("审核意见:") ? rtbContent.Text.Trim() : rtbContent.Text.Trim().Replace("审核意见:", ""); rtbContent.Text = Content; if (rtbContent.Text.Trim().Length > 200) { MessageBoxEx.Show("审核意见不能超过200个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rdbReturn.Checked && rtbContent.Text.Length == 0) { MessageBoxEx.Show("请填写审核意见!"); rtbContent.Focus(); return; } if (rdbOK.Checked) { auditStatus = DataSources.EnumAuditStatus.AUDIT; } else { auditStatus = DataSources.EnumAuditStatus.NOTAUDIT; } this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 审核报损单 /// </summary> /// <param name="send"></param> /// <param name="e"></param> private void UCReportedLossBillManager_VerifyEvent(object send, EventArgs e) { try { Dictionary <string, long> OrderIDDateDic = GetVerifyRecord();//获取需要核实的记录行 if (LossIDValuelist.Count == 0 && gvLossBillList.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择符合审核条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UCVerify UcVerify = new UCVerify(); UcVerify.ShowDialog(); if (UcVerify.DialogResult == DialogResult.OK) { string Content = UcVerify.Content; DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;//获取审核状态 Dictionary <string, string> ShippingBillField = new Dictionary <string, string>(); if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { //获取报损单状态(已审核) ShippingBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()); ShippingBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true)); } else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT) { //获取报损单状态(审核不通过) ShippingBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()); ShippingBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true)); } bool flag = DBHelper.BatchUpdateDataByIn(LossVerifyLogMsg, LossTable, ShippingBillField, StockLossID, LossIDValuelist.ToArray());//批量审核获取的报损单记录 if (flag) { if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { CommonFuncCall.StatisticStock(GetLossPart(OrderIDDateDic), "报损单配件表");//同步更新报损单账面库存 } MessageBoxEx.Show("审核成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); long StartDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.AddMonths(-6).ToShortDateString())); //获取当前日期的半年前的日期 long EndDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString())); //获取当前日期 string DefaultWhere = " enable_flag=1 and LsBillTb.order_date between " + StartDate + " and " + EndDate; //默认查询条件 GetRepLossBillList(DefaultWhere); //刷新报损单列表 } else { MessageBoxEx.Show("审核失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 if (string.IsNullOrEmpty(txtCarNO.Text.Trim())) { MessageBoxEx.Show("车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { MessageBoxEx.Show("客户编码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomName.Caption.Trim())) { MessageBoxEx.Show("客户名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { if (!Validator.IsMobile(txtContactPhone.Caption.Trim())) { MessageBoxEx.Show("联系人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List <SQLObj> listSql = new List <SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql, strId); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 审核其它收货单 /// </summary> /// <param name="send"></param> /// <param name="e"></param> private void UCStockCheckManager_VerifyEvent(object send, EventArgs e) { try { List <string> listField = GetVerifyRecord();//获取需要核实的记录行 if (listField.Count == 0 && gvCheckBillList.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择符合审核条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UCVerify UcVerify = new UCVerify(); UcVerify.ShowDialog(); string Content = UcVerify.Content; DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;//获取审核状态 Dictionary <string, string> CheckBillField = new Dictionary <string, string>(); if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { //获取其它收货单状态(已审核) CheckBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()); CheckBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true)); } else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT) { //获取其它收货单状态(审核不通过) CheckBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()); CheckBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true)); } bool flag = DBHelper.BatchUpdateDataByIn(CheckVerifyLogMsg, CheckTable, CheckBillField, CheckID, listField.ToArray());//批量审核获取的盘点单记录 if (flag) { MessageBoxEx.Show("审核成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); long StartDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.AddMonths(-6).ToShortDateString())); //获取当前日期的半年前的日期 long EndDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString())); //获取当前日期 string DefaultWhere = " enable_flag=1 and order_status_name='已审核通过' and CkBillTb.order_date between " + StartDate + " and " + EndDate; //默认查询条件 GetCheckBillList(DefaultWhere); //刷新盘点单列表 } else { MessageBoxEx.Show("审核失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 审核操作 /// </summary> /// <param name="send"></param> /// <param name="e"></param> private void UCAllocationBillManager_VerifyEvent(object send, EventArgs e) { try { Dictionary <string, long> OrderIDDateDic = GetVerifyRecord();//获取需要核实的记录行 if (InoutIDValuelist.Count == 0) { MessageBoxEx.Show("请选择符合审核条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UCVerify UcVerify = new UCVerify(); UcVerify.ShowDialog(); string Content = UcVerify.Content; DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;//获取审核状态 Dictionary <string, string> AllocBillField = new Dictionary <string, string>(); if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { //获取出入库单状态(已审核) AllocBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()); AllocBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true)); } else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT) { //获取出入库单状态(审核不通过) AllocBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()); AllocBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true)); } bool flag = DBHelper.BatchUpdateDataByIn(InOutVerifyLogMsg, InOutTable, AllocBillField, InOutID, InoutIDValuelist.ToArray());//批量审核获取的出入库单记录 if (flag) { CommonFuncCall.StatisticStock(GetInoutPart(OrderIDDateDic), "出入库单配件表"); //同步更新实际库存 MessageBoxEx.Show("审核成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); long StartDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.AddMonths(-6).ToShortDateString())); //获取当前日期的半年前的日期 long EndDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString())); //获取当前日期 string DefaultWhere = " enable_flag=1 and order_status_name='已审核通过' and IOBillTb.order_date between " + StartDate + " and " + EndDate; //默认查询条件 GetInOutBillList(DefaultWhere); //刷新出入库单列表 } else { MessageBoxEx.Show("审核失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 审核其它收货单 /// </summary> /// <param name="send"></param> /// <param name="e"></param> private void UCStockReceiptManager_VerifyEvent(object send, EventArgs e) { try { List <string> listField = GetVerifyRecord();//获取需要核实的记录行 if (listField.Count == 0 && gvReceiptBillList.SelectedRows.Count == 0) { MessageBoxEx.Show("请选择符合审核条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UCVerify UcVerify = new UCVerify(); UcVerify.ShowDialog(); string Content = UcVerify.Content; DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;//获取审核状态 Dictionary <string, string> ReceiptBillField = new Dictionary <string, string>(); if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { //获取其它收货单状态(已审核) ReceiptBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()); ReceiptBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true)); } else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT) { //获取其它收货单状态(审核不通过) ReceiptBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()); ReceiptBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true)); } bool flag = DBHelper.BatchUpdateDataByIn(ReceiptVerifyLogMsg, ReceiptTable, ReceiptBillField, ReceiptID, listField.ToArray());//批量审核获取的其它收货单记录 if (flag) { MessageBoxEx.Show("审核成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); string QueryWhere = " order_status_name='已审核通过' "; GetReceiptBillList(QueryWhere);//刷新其它收货单列表 } else { MessageBoxEx.Show("审核失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 审核操作 /// </summary> /// <param name="send"></param> /// <param name="e"></param> private void UCAllocationBillManager_VerifyEvent(object send, EventArgs e) { try { Dictionary <string, long> OrderIDDateDic = GetVerifyRecord();//获取需要核实的记录行 if (InoutIDValuelist.Count == 0) { MessageBoxEx.Show("请选择符合审核条件的单据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UCVerify UcVerify = new UCVerify(); UcVerify.ShowDialog(); string Content = UcVerify.Content; DataSources.EnumAuditStatus UcVerifyStatus = UcVerify.auditStatus;//获取审核状态 Dictionary <string, string> AllocBillField = new Dictionary <string, string>(); if (UcVerifyStatus == DataSources.EnumAuditStatus.AUDIT) { //获取出入库单状态(已审核) AllocBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()); AllocBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.AUDIT, true)); } else if (UcVerifyStatus == DataSources.EnumAuditStatus.NOTAUDIT) { //获取出入库单状态(审核不通过) AllocBillField.Add("order_status", Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()); AllocBillField.Add("order_status_name", DataSources.GetDescription(DataSources.EnumAuditStatus.NOTAUDIT, true)); } bool flag = DBHelper.BatchUpdateDataByIn(InOutVerifyLogMsg, InOutTable, AllocBillField, InOutID, InoutIDValuelist.ToArray());//批量审核获取的出入库单记录 if (flag) { CommonFuncCall.StatisticStock(OrderIDDateDic, InOutID, PartCount, InOutPartTable);//同步更新实际库存 MessageBoxEx.Show("审核成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); string QueryWhere = " order_status_name='已审核通过' "; GetInOutBillList(QueryWhere);//刷新出入库单列表 } else { MessageBoxEx.Show("审核失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 提交功能,提交时添加单号 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="status">单据状态</param> private void SubmitAndVerify(string strMessage, DataSources.EnumAuditStatus status) { List <SQLObj> listSql = new List <SQLObj>(); string strReceId = string.Empty; //单据Id值 string strOrderNo = string.Empty; //单据编号 foreach (DataGridViewRow dr in dgvRData.Rows) { object isCheck = dr.Cells["colCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { strReceId += dr.Cells["maintain_id"].Value.ToString() + ","; strOrderNo = dr.Cells["maintain_no"].Value.ToString(); SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); dicParam.Add("maintain_no", new ParamObj("maintain_no", !string.IsNullOrEmpty(strOrderNo)?strOrderNo: CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.Repair), SysDbType.VarChar, 40)); //单据编号 dicParam.Add("maintain_id", new ParamObj("maintain_id", dr.Cells["maintain_id"].Value, SysDbType.VarChar, 40)); //单据ID dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); //单据状态 dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = "update tb_maintain_info set info_status=@info_status,maintain_no=@maintain_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where maintain_id=@maintain_id"; obj.Param = dicParam; listSql.Add(obj); #region 更新前置单据的导入状态为锁定 string strBeforId = CommonCtrl.IsNullToString(dr.Cells["before_orderId"].Value); //前置单据Id string strBeforSource = CommonCtrl.IsNullToString(dr.Cells["orders_source"].Value); //前置单据来源1预约单、2返修单 UpdateMaintainInfo(listSql, strBeforId, strBeforSource, "2", strOrderNo); #endregion } } if (string.IsNullOrEmpty(strReceId)) { MessageBoxEx.Show("请选择需要" + strMessage + "的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (DBHelper.BatchExeSQLMultiByTrans("更新单据状态为提交", listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } }
/// <summary> /// 提交功能,提交时添加单号 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="status">单据状态</param> private void SubmitAndVerify(string strMessage, DataSources.EnumAuditStatus status) { if (MessageBoxEx.Show("确认要提交吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List <SQLObj> listSql = new List <SQLObj>(); string strReceId = string.Empty; //单据Id值 string strOrderNo = string.Empty; //单据编号 foreach (DataGridViewRow dr in dgvRData.Rows) { object isCheck = dr.Cells["colCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { strReceId += dr.Cells["oldpart_id"].Value.ToString() + ","; strOrderNo = dr.Cells["receipts_no"].Value.ToString(); SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); dicParam.Add("receipts_no", new ParamObj("receipts_no", !string.IsNullOrEmpty(strOrderNo)?strOrderNo: CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.PartsReceipt), SysDbType.VarChar, 40)); //单据编号 dicParam.Add("oldpart_id", new ParamObj("oldpart_id", dr.Cells["oldpart_id"].Value, SysDbType.VarChar, 40)); //单据ID dicParam.Add("info_status", new ParamObj("info_status", status, SysDbType.VarChar, 40)); //单据状态 dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = "update tb_maintain_oldpart_receiv_send set info_status=@info_status,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where oldpart_id=@oldpart_id"; obj.Param = dicParam; listSql.Add(obj); } } if (string.IsNullOrEmpty(strReceId)) { MessageBoxEx.Show("请选择需要" + strMessage + "的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (DBHelper.BatchExeSQLMultiByTrans("更新单据状态为提交", listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); BindPageData(); } }
/// <summary> /// 加载采购计划信息和配件信息 /// </summary> /// <param name="order_id"></param> private void LoadInfo(string order_id) { if (!string.IsNullOrEmpty(order_id)) { //1.查看一条采购订单信息 DataTable dt = DBHelper.GetTable("查看一条采购订单信息", "tb_parts_purchase_order", "*", " order_id='" + order_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_partspurchaseorder_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_partspurchaseorder_Model, ""); chkis_suspend.Checked = tb_partspurchaseorder_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 if (!string.IsNullOrEmpty(lblorder_status.Text)) { DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(lblorder_status.Text); lblorder_status.Text = DataSources.GetDescription(enumDataSources, true); } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblvalid_till.Text)) { long ticks = Convert.ToInt64(lblvalid_till.Text); lblvalid_till.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblarrival_date.Text)) { long ticks = Convert.ToInt64(lblarrival_date.Text); lblarrival_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.create_time.ToString())).ToString(); if (tb_partspurchaseorder_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.update_time.ToString())).ToString(); } } } }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 string strSCurrentSMon = dtpSTime.Value.Month.ToString(); //创建日期范围开始日期的月份 string strSCurrentEMon = dtpETime.Value.Month.ToString(); //创建日期范围结束日期的月份 if (strSCurrentEMon != strSCurrentSMon) { MessageBoxEx.Show("创建日期范围必须在同一个月!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } string strSCurrentSDay = dtpSTime.Value.Day.ToString();//创建日期范围开始日期的天 if (strSCurrentSDay != "1") { MessageBoxEx.Show("创建日期范围,开始日期必须为每月第1天!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (dtpSTime.Value.AddMonths(1).AddDays(-1).ToShortDateString() != dtpETime.Value.ToShortDateString()) { MessageBoxEx.Show("创建日期范围必须为整月份!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(laboldpart_receipts_no.Text)) { MessageBoxEx.Show("请先执行同步操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion if (!string.IsNullOrEmpty(laboldpart_receipts_no.Text.Trim())) { string result = DBHelper.GetSingleValue("检测该单号是否存在", "tb_maintain_oldpart_recycle", "receipt_time", "oldpart_receipts_no='" + laboldpart_receipts_no.Text.Trim() + "'", ""); if (!string.IsNullOrEmpty(result)) { MessageBoxEx.Show("该日期范围内的旧件返厂单据已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } } if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List <SQLObj> listSql = new List <SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql); if (Estatus == DataSources.EnumAuditStatus.SUBMIT) { ProcessModeToYT();//提交时把处理状态提交到宇通 } if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 保存、提交方法 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="Estatus">单据操作状态</param> private void SaveOrSubmitMethod(string strMessage, DataSources.EnumAuditStatus Estatus) { try { #region 必要的判断 if (string.IsNullOrEmpty(CommonCtrl.IsNullToString(dtpReceiptTime.Value))) { MessageBoxEx.Show("发货日期不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { MessageBoxEx.Show("客户编码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtCustomName.Caption.Trim())) { MessageBoxEx.Show("客户名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim()))//联系人手机 { if (!Validator.IsMobile(txtContactPhone.Caption.Trim())) { MessageBoxEx.Show("联系人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } int intPartCount = 0; foreach (DataGridViewRow dgvr in dgvMaterials.Rows) { string strPname = CommonCtrl.IsNullToString(dgvr.Cells["parts_name"].Value); string strPCode = CommonCtrl.IsNullToString(dgvr.Cells["parts_code"].Value); if (strPname.Length > 0 && strPCode.Length > 0) { intPartCount++; } } if (intPartCount == 0) { MessageBoxEx.Show("配件信息不能为空,请添加配件信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } List <SQLObj> listSql = new List <SQLObj>(); SaveOrderInfo(listSql, Estatus); SaveMaterialsData(listSql, strId); if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql)) { MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void SaveOrderInfo(List <SQLObj> listSql, DataSources.EnumAuditStatus status) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); #region 基本信息 dicParam.Add("receipt_time", new ParamObj("receipt_time", Common.LocalDateTimeToUtcLong(dtpReceiptTime.Value).ToString(), SysDbType.BigInt)); //制单时间 dicParam.Add("customer_code", new ParamObj("customer_code", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text)) ? txtCustomNO.Text.Trim() : null, SysDbType.VarChar, 40)); //客户编码 dicParam.Add("customer_id", new ParamObj("customer_id", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Tag)) ? txtCustomNO.Tag.ToString() : null, SysDbType.VarChar, 40)); //客户Id dicParam.Add("customer_name", new ParamObj("customer_name", txtCustomName.Caption.Trim(), SysDbType.VarChar, 20)); //客户名称 dicParam.Add("linkman", new ParamObj("linkman", txtContact.Caption.Trim(), SysDbType.VarChar, 20)); //联系人 if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim())) //联系人手机 { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", txtContactPhone.Caption.Trim(), SysDbType.VarChar, 15)); //联系人手机 } else { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", null, SysDbType.VarChar, 15)); //联系人手机 } dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200)); //备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1));//信息状态(1|激活;2|作废;0|删除) //单据类型 dicParam.Add("receipt_type", new ParamObj("receipt_type", "2", SysDbType.VarChar, 2)); if (status == DataSources.EnumAuditStatus.SUBMIT) //提交操作时生成单号 { dicParam.Add("receipts_no", new ParamObj("receipts_no", labReceiptNoS.Text.Trim(), SysDbType.VarChar, 40)); //发货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); //更新前置单据导入状态 if (!string.IsNullOrEmpty(strBefore_orderId)) { UpdateMaintainInfo(listSql, strBefore_orderId, "2"); } } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicParam.Add("receipts_no", new ParamObj("receipts_no", labReceiptNoS.Text.Trim(), SysDbType.VarChar, 40));//发货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); dicParam.Add("receipts_no", new ParamObj("receipts_no", null, SysDbType.VarChar, 40));//发货单号 } //更新前置单据导入状态 if (!string.IsNullOrEmpty(strBefore_orderId)) { UpdateMaintainInfo(listSql, strBefore_orderId, "0"); } } if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { strId = Guid.NewGuid().ToString(); dicParam.Add("oldpart_id", new ParamObj("oldpart_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into tb_maintain_oldpart_receiv_send (receipt_time,customer_code,customer_id,customer_name,linkman,link_man_mobile,remarks,responsible_opid ,responsible_name,org_name,enable_flag,info_status,receipt_type,receipts_no,oldpart_id, create_by,create_name,create_time) values (@receipt_time,@customer_code,@customer_id,@customer_name,@linkman,@link_man_mobile,@remarks,@responsible_opid ,@responsible_name,@org_name,@enable_flag,@info_status,@receipt_type,@receipts_no,@oldpart_id,@create_by,@create_name,@create_time);"; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("oldpart_id", new ParamObj("oldpart_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = @"update tb_maintain_oldpart_receiv_send set receipt_time=@receipt_time,customer_code=@customer_code,customer_id=@customer_id,customer_name=@customer_name,linkman=@linkman,link_man_mobile=@link_man_mobile,remarks=@remarks,responsible_opid=@responsible_opid ,responsible_name=@responsible_name,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipt_type=@receipt_type,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where oldpart_id=@oldpart_id"; } obj.Param = dicParam; listSql.Add(obj); }
/// <summary> /// 保存、提交功能 /// </summary> /// <param name="strMessage">提示信息</param> /// <param name="status">单据状态</param> private void SaveAndSubmit(string strMessage, DataSources.EnumAuditStatus status) { try { string currCom_id = string.Empty;//当前信息编号 #region 必要的判断 //是否接车,默认不接 string strIsGreet = "0"; if (ckbYes.Checked) { strIsGreet = "1"; } if (string.IsNullOrEmpty(txtCarNO.Text.Trim())) { MessageBoxEx.Show("车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (string.IsNullOrEmpty(txtRepPerson.Caption.Trim())) { MessageBoxEx.Show("预约人不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } if (!string.IsNullOrEmpty(txtRepPersonPhone.Caption.Trim()))//预约人手机 { if (!Validator.IsMobile(txtRepPersonPhone.Caption.Trim())) { MessageBoxEx.Show("预约人手机号码格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { MessageBoxEx.Show("预约人手机不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); return; } #endregion if (MessageBoxEx.Show("确认要" + strMessage + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } string opName = "新增预约单"; Dictionary <string, string> dicFileds = new Dictionary <string, string>(); #region 表字段赋值 dicFileds.Add("reservation_date", Common.LocalDateTimeToUtcLong(dtpReTime.Value).ToString()); //预约日期 dicFileds.Add("vehicle_no", CommonCtrl.IsNullToString(txtCarNO.Text.Trim())); //车牌号 dicFileds.Add("vehicle_vin", txtVIN.Caption.Trim()); //VIN dicFileds.Add("engine_type", txtEngineNo.Caption.Trim()); //发动机号 dicFileds.Add("vehicle_model", CommonCtrl.IsNullToString(txtCarType.Tag)); //车型 dicFileds.Add("vehicle_brand", cobCarBrand.SelectedValue != null ? cobCarBrand.SelectedValue.ToString() : ""); //车辆品牌 dicFileds.Add("vehicle_color", cobColor.SelectedValue != null ? cobColor.SelectedValue.ToString() : ""); //颜色 dicFileds.Add("customer_code", txtCustomNO.Text.Trim()); //客户编码 dicFileds.Add("customer_name", txtCustomName.Caption.Trim()); //客户名称 if (!string.IsNullOrEmpty(txtCustomNO.Text.Trim())) { dicFileds.Add("customer_id", CommonCtrl.IsNullToString(txtCustomNO.Tag)); //客户关联id } dicFileds.Add("linkman", txtContact.Caption.Trim()); //联系人 dicFileds.Add("link_man_mobile", txtContactPhone.Caption.Trim()); dicFileds.Add("maintain_payment", cobPayType.SelectedValue != null ? cobPayType.SelectedValue.ToString() : ""); //维修付费方式 dicFileds.Add("maintain_type", cobRepType.SelectedValue != null ? cobRepType.SelectedValue.ToString() : ""); //维修类别 dicFileds.Add("reservation_man", txtRepPerson.Caption.Trim()); //预约人 dicFileds.Add("reservation_mobile", txtRepPersonPhone.Caption.Trim()); //预约人手机 dicFileds.Add("whether_greet", strIsGreet); //是否接车,1是0否 dicFileds.Add("greet_site", txtAddress.Caption.Trim()); //接车地址 dicFileds.Add("maintain_time", Common.LocalDateTimeToUtcLong(dtpInTime.Value).ToString()); //预约进场时间 dicFileds.Add("fault_describe", txtDesc.Caption.Trim()); //故障描述 dicFileds.Add("remark", txtRemark.Caption.Trim()); //备注 if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue))) { dicFileds.Add("responsible_opid", cobYHandle.SelectedValue.ToString()); //经办人id dicFileds.Add("responsible_name", CommonCtrl.IsNullToString(cobYHandle.SelectedText)); //经办人 } if (!string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue))) { dicFileds.Add("org_name", cboOrgId.SelectedValue.ToString()); //部门 } dicFileds.Add("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString()); //信息状态(1|激活;2|作废;0|删除) if (status == DataSources.EnumAuditStatus.SUBMIT) //提交时生成预约单号 { dicFileds.Add("reservation_no", labReserveNoS.Text); //预约单号 dicFileds.Add("document_status", Convert.ToInt32(status).ToString()); //单据状态(0为草稿) } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicFileds.Add("reservation_no", labReserveNoS.Text.Trim()); //预约单号 dicFileds.Add("document_status", Convert.ToInt32(status).ToString()); //单据状态0为草稿 } else { dicFileds.Add("document_status", Convert.ToInt32(status).ToString());//单据状态0为草稿 } } dicFileds.Add("Import_status", Convert.ToInt32(DataSources.EnumImportStaus.OPEN).ToString());//导入状态 #endregion if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { currCom_id = Guid.NewGuid().ToString(); dicFileds.Add("reserv_id", currCom_id); ////新ID dicFileds.Add("create_by", HXCPcClient.GlobalStaticObj.UserID); //创建人id(制单人) dicFileds.Add("create_name", HXCPcClient.GlobalStaticObj.UserName); //创建人 dicFileds.Add("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString()); //创建时间 } else if (wStatus == WindowStatus.Edit) { keyName = "reserv_id"; keyValue = strId; currCom_id = strId; opName = "更新预约单"; dicFileds.Add("update_by", HXCPcClient.GlobalStaticObj.UserID); //最后修改人id dicFileds.Add("update_name", HXCPcClient.GlobalStaticObj.UserName); //修改人姓名 dicFileds.Add("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString()); //修改时间 } bool bln = DBHelper.Submit_AddOrEdit(opName, "tb_maintain_reservation", keyName, keyValue, dicFileds); if (bln) { SaveProjectData(currCom_id); SaveMaterialsData(currCom_id); MessageBoxEx.Show("" + strMessage + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); uc.BindPageData(); deleteMenuByTag(this.Tag.ToString(), this.uc.Name); } else { MessageBoxEx.Show("" + strMessage + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBoxEx.Show("" + strMessage + "失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void SaveOrderInfo(List <SQLObj> listSql, DataSources.EnumAuditStatus status) { try { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); #region 基本信息 dicParam.Add("vehicle_no", new ParamObj("vehicle_no", txtCarNO.Text.Trim(), SysDbType.VarChar, 20)); //车牌号 dicParam.Add("refund_time", new ParamObj("refund_time", Common.LocalDateTimeToUtcLong(dtpMakeOrderTime.Value).ToString(), SysDbType.BigInt)); //退料时间 dicParam.Add("vehicle_model", new ParamObj("vehicle_model", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCarType.Tag)) ? txtCarType.Tag : null, SysDbType.VarChar, 40)); //车型 dicParam.Add("customer_code", new ParamObj("customer_code", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtCustomNO.Text)) ? txtCustomNO.Text.Trim() : null, SysDbType.VarChar, 40)); //客户编码 dicParam.Add("customer_name", new ParamObj("customer_name", txtCustomName.Caption.Trim(), SysDbType.VarChar, 20)); //客户名称 dicParam.Add("linkman", new ParamObj("linkman", txtContact.Caption.Trim(), SysDbType.VarChar, 20)); //联系人 if (!string.IsNullOrEmpty(txtContactPhone.Caption.Trim())) //联系人手机 { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", txtContactPhone.Caption.Trim(), SysDbType.VarChar, 15)); //联系人手机 } else { dicParam.Add("link_man_mobile", new ParamObj("link_man_mobile", null, SysDbType.VarChar, 15)); //联系人手机 } dicParam.Add("refund_opid", new ParamObj("refund_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtRFetchOpid.Tag)) ? txtRFetchOpid.Tag.ToString() : null, SysDbType.VarChar, 40)); //退料人 dicParam.Add("material_no", new ParamObj("material_no", txtOrder.Caption.Trim(), SysDbType.VarChar, 40)); //领料单号 dicParam.Add("fetch_opid", new ParamObj("fetch_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(txtFetchOpid.Tag)) ? txtFetchOpid.Tag.ToString() : null, SysDbType.VarChar, 40)); //领料人 dicParam.Add("packing_time", new ParamObj("packing_time", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtpFetchTime.Caption)).ToString(), SysDbType.BigInt)); //领料时间 dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200)); //备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedText : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1)); //信息状态(1|激活;2|作废;0|删除) if (status == DataSources.EnumAuditStatus.SUBMIT) //提交操作时生成单号 { dicParam.Add("refund_no", new ParamObj("refund_no", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40)); //领料退货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); //更新前置单据导入状态 if (!string.IsNullOrEmpty(strId)) { UpdateMaintainInfo(listSql, strId, Convert.ToInt32(DataSources.EnumImportStaus.LOCK).ToString()); } } else { if (!string.IsNullOrEmpty(strStatus) && strStatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString()) { dicParam.Add("refund_no", new ParamObj("refund_no", labReserveNoS.Text.Trim(), SysDbType.VarChar, 40));//领料退货单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); dicParam.Add("refund_no", new ParamObj("refund_no", null, SysDbType.VarChar, 40));//领料退货单号 } //更新前置单据导入状态 if (!string.IsNullOrEmpty(strId)) { UpdateMaintainInfo(listSql, strId, Convert.ToInt32(DataSources.EnumImportStaus.OPEN).ToString()); } } if (wStatus == WindowStatus.Add || wStatus == WindowStatus.Copy) { strId = Guid.NewGuid().ToString(); dicParam.Add("refund_id", new ParamObj("refund_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"insert into tb_maintain_refund_material (vehicle_no,refund_time,vehicle_model,customer_code,customer_name,linkman,link_man_mobile ,refund_opid,material_no,fetch_opid,packing_time,remarks,responsible_opid,responsible_name,org_name,enable_flag,info_status,refund_no,refund_id ,create_by,create_name,create_time) values (@vehicle_no,@refund_time,@vehicle_model,@customer_code,@customer_name,@linkman,@link_man_mobile ,@refund_opid,@material_no,@fetch_opid,@packing_time,@remarks,@responsible_opid,@responsible_name,@org_name,@enable_flag,@info_status,@refund_no,@refund_id ,@create_by,@create_name,@create_time);"; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("refund_id", new ParamObj("refund_id", strId, SysDbType.VarChar, 40)); //Id dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = @"update tb_maintain_refund_material set vehicle_no=@vehicle_no,refund_time=@refund_time,vehicle_model=@vehicle_model,customer_code=@customer_code,customer_name=@customer_name,linkman=@linkman,link_man_mobile=@link_man_mobile ,refund_opid=@refund_opid,material_no=@material_no,fetch_opid=@fetch_opid,packing_time=@packing_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,refund_no=@refund_no ,update_by=@update_by,update_name=@update_name,update_time=@update_time where refund_id=@refund_id"; } obj.Param = dicParam; listSql.Add(obj); } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
private void SaveOrderInfo(List <SQLObj> listSql, DataSources.EnumAuditStatus status) { SQLObj obj = new SQLObj(); obj.cmdType = CommandType.Text; Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>(); #region 基本信息 dicParam.Add("receipt_time", new ParamObj("receipt_time", Common.LocalDateTimeToUtcLong(dtpMakeOrderTime.Value).ToString(), SysDbType.BigInt)); //制单日期 dicParam.Add("remarks", new ParamObj("remarks", txtRemark.Caption.Trim(), SysDbType.VarChar, 200)); //备注 #endregion //经办人id dicParam.Add("responsible_opid", new ParamObj("responsible_opid", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedValue.ToString() : null, SysDbType.VarChar, 40)); //经办人 dicParam.Add("responsible_name", new ParamObj("responsible_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cobYHandle.SelectedValue)) ? cobYHandle.SelectedText : null, SysDbType.VarChar, 40)); //部门 dicParam.Add("org_name", new ParamObj("org_name", !string.IsNullOrEmpty(CommonCtrl.IsNullToString(cboOrgId.SelectedValue)) ? cboOrgId.SelectedValue : null, SysDbType.VarChar, 40)); dicParam.Add("enable_flag", new ParamObj("enable_flag", Convert.ToInt32(DataSources.EnumEnableFlag.USING).ToString(), SysDbType.VarChar, 1));//信息状态(1|激活;2|作废;0|删除) //单据类型 if (status == DataSources.EnumAuditStatus.SUBMIT) //提交操作时生成单号 { dicParam.Add("receipts_no", new ParamObj("receipts_no", labPalNoS.Text.Trim(), SysDbType.VarChar, 40)); //返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } else { if (!string.IsNullOrEmpty(strStatus) && strStatus != Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { dicParam.Add("receipts_no", new ParamObj("receipts_no", labPalNoS.Text.Trim(), SysDbType.VarChar, 40));//返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(strStatus).ToString(), SysDbType.VarChar, 40)); } else { dicParam.Add("receipts_no", new ParamObj("receipts_no", null, SysDbType.VarChar, 40));//返厂单号 //单据状态 dicParam.Add("info_status", new ParamObj("info_status", Convert.ToInt32(status).ToString(), SysDbType.VarChar, 40)); } } dicParam.Add("return_id", new ParamObj("return_id", strId, SysDbType.VarChar, 40));//Id if (wStatus == WindowStatus.Add) { strId = Guid.NewGuid().ToString(); dicParam.Add("create_by", new ParamObj("create_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //创建人id(制单人) dicParam.Add("create_name", new ParamObj("create_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //创建人 dicParam.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); obj.sqlString = @"update tb_maintain_oldpart_recycle set receipt_time=@receipt_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name ,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipts_no=@receipts_no,create_by=@create_by,create_name=@create_name,create_time=@create_time where return_id=@return_id "; } else if (wStatus == WindowStatus.Edit) { dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40)); //修改人Id dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40)); //修改人姓名 dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间 obj.sqlString = @"update tb_maintain_oldpart_recycle set receipt_time=@receipt_time,remarks=@remarks,responsible_opid=@responsible_opid,responsible_name=@responsible_name ,org_name=@org_name,enable_flag=@enable_flag,info_status=@info_status,receipts_no=@receipts_no,update_by=@update_by,update_name=@update_name,update_time=@update_time where return_id=@return_id"; } obj.Param = dicParam; listSql.Add(obj); }
/// <summary> /// 加载采购计划信息和配件信息 /// </summary> /// <param name="order_id"></param> private void LoadInfo(string order_id) { if (!string.IsNullOrEmpty(order_id)) { //1.查看一条采购订单信息 DataTable dt = DBHelper.GetTable("查看一条采购订单信息", "tb_parts_purchase_order", "*", " order_id='" + order_id + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { CommonFuncCall.SetModlByDataTable(tb_partspurchaseorder_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_partspurchaseorder_Model, ""); chkis_suspend.Checked = tb_partspurchaseorder_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1 if (!string.IsNullOrEmpty(lblorder_status.Text)) { DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(lblorder_status.Text); lblorder_status.Text = DataSources.GetDescription(enumDataSources, true); } if (!string.IsNullOrEmpty(lblorder_date.Text)) { long ticks = Convert.ToInt64(lblorder_date.Text); lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblvalid_till.Text)) { long ticks = Convert.ToInt64(lblvalid_till.Text); lblvalid_till.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } if (!string.IsNullOrEmpty(lblarrival_date.Text)) { long ticks = Convert.ToInt64(lblarrival_date.Text); lblarrival_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString(); } lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.create_time.ToString())).ToString(); if (tb_partspurchaseorder_Model.update_time > 0) { lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.update_time.ToString())).ToString(); } orderstatus = tb_partspurchaseorder_Model.order_status.ToString(); if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString()) { //已提交状态屏蔽提交、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString()) { //已审核时屏蔽提交、审核、编辑、删除按钮 base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; base.btnDelete.Enabled = false; base.btnActivation.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString()) { //审核没通过时屏蔽审核按钮 base.btnVerify.Enabled = false; } else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString()) { base.btnActivation.Caption = "激活"; base.btnSubmit.Enabled = false; base.btnVerify.Enabled = false; base.btnEdit.Enabled = false; } } } }