protected override void OnClick(EventArgs e) { try { LBPermission.VerifyUserPermission(this.Text, LBPermissionCode); //LBLog.InsertSysLog(LBPermissionCode); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); return; } base.OnClick(e); }
private void LBDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex >= 0 && e.RowIndex >= 0) { if (this[e.ColumnIndex, e.RowIndex] is DataGridViewButtonCell) { DataGridViewColumn dc = this.Columns[e.ColumnIndex]; if (dc is LBDataGridViewButtonColumn) { LBDataGridViewButtonColumn buttonColumn = dc as LBDataGridViewButtonColumn; if (buttonColumn.LBPermissionCode != "") { try { LBPermission.VerifyUserPermission(buttonColumn.Text, buttonColumn.LBPermissionCode); } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); return; } } } if (LBCellButtonClick != null) { LBCellButtonClick(sender, e); } } } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void InitData() { LBPermission.ReadAllPermission(); //加载所有权限信息 SetLoginStatus(); //设置状态栏信息 LBLog.AssemblyStart(); }
private void btnSubmitReturn_Click(object sender, EventArgs e) { try { LBPermission.VerifyUserPermission("确认退货", "WeightSalesReturnOut_Save"); decimal decTareCar = LBConverter.ToDecimal(this.txtCarTare.Text);//原皮重值 decimal decInWeight = LBConverter.ToDecimal(this.txtInWeight.Text); decimal decOutWeight = LBConverter.ToDecimal(this.txtOutWeight.Text); int iReturnType = LBConverter.ToInt32(this.txtReturnType.SelectedValue); int iReturnReason = LBConverter.ToInt32(this.txtReturnReason.SelectedValue); if (decInWeight <= 0) { throw new Exception("入场称重值不能为0"); } if (decOutWeight <= 0) { throw new Exception("出场场称重值不能为0"); } if (this.txtReturnType.SelectedValue == null || this.txtReturnType.SelectedValue.ToString() == "") { throw new Exception("请选择退货方式"); } if (this.txtReturnReason.SelectedValue == null || this.txtReturnReason.SelectedValue.ToString() == "") { throw new Exception("请选择退货原因"); } if (iReturnType == 0)//完全退货状态下必须校验原来车辆入场皮重与现在出场皮重是否存在较大磅差 { if (Math.Abs(decTareCar - decOutWeight) > 1000) { throw new Exception("该车辆记录的入场皮重与空车出场重量的磅差太大,无法出场,请检查该车辆是否已卸载完毕!"); } } string strSaleCarInBillCode = this.txtSaleCarInBillCode.Text.TrimEnd(); if (strSaleCarInBillCode != "") { long lSaleCarInBillID = 0; #region -- 查询入场单信息 -- DataTable dtInBill = ExecuteSQL.CallView(125, "SaleCarInBillID,SaleCarOutBillID", "SaleCarInBillCode='" + strSaleCarInBillCode + "'", ""); if (dtInBill.Rows.Count > 0) { lSaleCarInBillID = LBConverter.ToInt64(dtInBill.Rows[0]["SaleCarInBillID"]); } #endregion #region -- 判断该车辆是否正在走退货流程(即退货入场但未出场) long lSaleCarReturnBillID = 0; DataTable dtInReturnBill = ExecuteSQL.CallView(137, "", "ReturnStatus=0 and SaleCarInBillID=" + lSaleCarInBillID.ToString(), ""); if (dtInReturnBill.Rows.Count == 0) { throw new Exception("该车辆没有退货入场记录!"); } else { lSaleCarReturnBillID = LBConverter.ToInt64(dtInReturnBill.Rows[0]["SaleCarReturnBillID"]); } #endregion if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认退货?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarReturnBillID", enLBDbType.Int64, lSaleCarReturnBillID)); parmCol.Add(new LBParameter("CarTare", enLBDbType.Decimal, decOutWeight)); parmCol.Add(new LBParameter("SuttleWeight", enLBDbType.Decimal, decInWeight - decOutWeight)); parmCol.Add(new LBParameter("ReturnType", enLBDbType.Int16, iReturnType)); parmCol.Add(new LBParameter("ReturnReason", enLBDbType.Int16, iReturnReason)); parmCol.Add(new LBParameter("Description", enLBDbType.String, "")); parmCol.Add(new LBParameter("NewSaleCarInBillCode", enLBDbType.String, "")); parmCol.Add(new LBParameter("NewSaleCarOutBillCode", enLBDbType.String, "")); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(30001, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("NewSaleCarOutBillCode")) { string strNewSaleCarOutBillCode = dictValue["NewSaleCarOutBillCode"].ToString(); if (strNewSaleCarOutBillCode != "") { Thread threadSavePic = new Thread(SaveOutSalesPicture); threadSavePic.Start(lSaleCarReturnBillID); LB.WinFunction.LBCommonHelper.ShowCommonMessage("退货完成!原磅单已作废,生成新的磅单为:" + strNewSaleCarOutBillCode); ClearAllBillInfo(); if (dictValue.ContainsKey("NewSaleCarOutBillID")) { long lNewSaleCarOutBillID = LBConverter.ToInt64(dictValue["NewSaleCarOutBillID"]); if (lNewSaleCarOutBillID > 0) { if (PrintOutBillEvent != null) { Billinfo billInfo = new Billinfo(lNewSaleCarOutBillID); PrintOutBillEvent(this, billInfo); } } } } } if (iReturnType == 0)//完全退货 { LB.WinFunction.LBCommonHelper.ShowCommonMessage("完全退货完成,原磅单已作废!"); ClearAllBillInfo(); } LoadReturnBill(); } } else { throw new Exception("入场单号不能为空!"); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }
private void btnInWeight_Click(object sender, EventArgs e) { try { LBPermission.VerifyUserPermission("称重并保存", "WeightSalesReturnIn_Save"); //先读取重量 VerifyDeviceIsSteady(); //校验地磅数值是否稳定以及红外线对射是否正常 VerifyTextBoxIsEmpty(); //判断相关控件值是否为空 long lCarID = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID); long lItemID = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID); long lCustomerID = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID); string strSaleCarInBillCode = this.txtSaleCarInBillCode.Text.TrimEnd(); if (strSaleCarInBillCode != "") { long lSaleCarInBillID = 0; #region -- 判断是否存在未出场记录 -- DataTable dtInBill = ExecuteSQL.CallView(125, "SaleCarInBillID,SaleCarOutBillID", "SaleCarInBillCode='" + strSaleCarInBillCode + "'", ""); if (dtInBill.Rows.Count > 0) { lSaleCarInBillID = LBConverter.ToInt64(dtInBill.Rows[0]["SaleCarInBillID"]); long lSaleCarOutBillID = LBConverter.ToInt64(dtInBill.Rows[0]["SaleCarOutBillID"]); if (lSaleCarOutBillID == 0) { throw new Exception("该车辆存在入场而未出场记录,无法退货!"); } } #endregion #region -- 判断该车辆是否正在走退货流程(即退货入场但未出场) DataTable dtInReturnBill = ExecuteSQL.CallView(137, "*", "ReturnStatus=0 and SaleCarInBillID=" + lSaleCarInBillID.ToString(), ""); if (dtInReturnBill.Rows.Count > 0) { throw new Exception("该车辆正在场内退货,无法进行入场称重!"); } #endregion decimal decWeight = LBConverter.ToDecimal(lblWeight.Text);//读皮重 this.txtInWeight.Text = decWeight.ToString("0"); if (LB.WinFunction.LBCommonHelper.ConfirmMessage("是否确认退货?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { decimal decInWeight = LBConverter.ToDecimal(this.txtInWeight.Text); if (decInWeight <= 0) { throw new Exception("入场称重值不能为0"); } LBDbParameterCollection parmCol = new LBDbParameterCollection(); parmCol.Add(new LBParameter("SaleCarReturnBillID", enLBDbType.Int64, 0)); parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, lSaleCarInBillID)); parmCol.Add(new LBParameter("TotalWeight", enLBDbType.Decimal, decInWeight)); DataSet dsReturn; Dictionary <string, object> dictValue; ExecuteSQL.CallSP(30000, parmCol, out dsReturn, out dictValue); if (dictValue.ContainsKey("SaleCarReturnBillID")) { long SaleCarReturnBillID = LBConverter.ToInt64(dictValue["SaleCarReturnBillID"]); if (SaleCarReturnBillID > 0) { Thread threadSavePic = new Thread(SaveInSalesPicture); threadSavePic.Start(SaleCarReturnBillID); LB.WinFunction.LBCommonHelper.ShowCommonMessage("生成入场退货单成功!"); ClearAllBillInfo(); LoadReturnBill(); } } } } else { throw new Exception("入场单号不能为空!"); } } catch (Exception ex) { LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex); } }