/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var order = FKOrderService.Where(p => p.keyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (order != null) { order.FCode = txtFCode.Text; order.FName = tbxFCustomer.Text; //-------------------------------------------------- order.FDeleteFlag = 0; order.FMemo = txtFMemo.Text.Trim(); order.CreateBy = CurrentUser.AccountName; order.FDate = txtFDate.SelectedDate; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@KeyId", order.keyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_FKOrderAmt", parms).Tables[0].Rows[0][0]); order.FAmount = amt; FKOrderService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "NF", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "19"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增现金费用单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim()).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FCompanyId = CurrentUser.AccountComId; stock.FDeleteFlag = 0; stock.FMemo = txtFMemo.Text.Trim(); stock.FDate = txtFDate.SelectedDate; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PY", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "10"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增盘盈单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); try { Log(string.Format(@"作废单据号:{0}成功。", selectIds)); // foreach (var ids in selectIds) { var status = new LHBillStatus(); status.FCompanyId = CurrentUser.AccountComId; status.FDeptId = CurrentUser.AccountOrgId; status.FDate = DateTime.Now; status.FOperator = CurrentUser.AccountName; status.FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided); status.KeyId = ids; status.FMemo = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName); GasHelper.AddBillStatus(status); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@KeyId", ids); parms.Add("@companyId", CurrentUser.AccountComId); parms.Add("@Bill", 1); SqlService.ExecuteProcedureNonQuery("proc_DeleteFlag", parms); } StockOutService.Update(p => p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHStockOut { FFlag = 0, // FStatus = Convert.ToInt32(GasEnumBillStauts.Voided), // FProgress = Convert.ToInt32(GasEnumBillStauts.Voided) }); //PassCardService.Update(p =>p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHPassCard //{ // FFlag = 0, // // FStatus = Convert.ToInt32(GasEnumBillStauts.Add), // // FProgress = Convert.ToInt32(GasEnumBillStauts.Add) //}); Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); try { Log(string.Format(@"作废单据号:{0}成功。", selectIds)); using (var trans = new TransactionScope()) { // foreach (var ids in selectIds) { var status = new LHBillStatus(); status.FCompanyId = CurrentUser.AccountComId; status.FDeptId = CurrentUser.AccountOrgId; status.FDate = DateTime.Now; status.FOperator = CurrentUser.AccountName; status.FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided); status.KeyId = ids; status.FMemo = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName); GasHelper.AddBillStatus(status); } LeaseService.Update(p => selectIds.Contains(p.KeyId), p => new LHLease { FFlag = 0, // FStatus = Convert.ToInt32(GasEnumBillStauts.Voided), // FProgress = Convert.ToInt32(GasEnumBillStauts.Voided) }); foreach (var ids in selectIds) { var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", ids); parms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_LeaseKillSK", parms); } trans.Complete(); } Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = DispatchCommissionService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { AddListGrid(); ModifiedGrid(); ///////////////////////////////////////////////////////////////////////////// stock.FDate = txtFDate.SelectedDate; stock.FMemo = txtFMemo.Text.Trim(); DispatchCommissionService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TC", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "14"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增送货提成单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); try { Log(string.Format(@"作废单据号:{0}成功。", selectIds)); //StockInService.Update(p => selectIds.Contains(p.KeyId), p => new LHStockIn { FFlag = 0 }); // foreach (string ids in selectIds) { LHBillStatus status = new LHBillStatus { FCompanyId = CurrentUser.AccountComId, FDeptId = CurrentUser.AccountOrgId, FDate = DateTime.Now, FOperator = CurrentUser.AccountName, FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided), KeyId = ids, FMemo = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName) }; GasHelper.AddBillStatus(status); } StockInService.Update(p => selectIds.Contains(p.KeyId), p => new LHStockIn { FFlag = 0, // FStatus = Convert.ToInt32(GasEnumBillStauts.Voided), // FProgress = Convert.ToInt32(GasEnumBillStauts.Voided) }); Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { //生成调度单 LHDispatchCenter dispatch = new LHDispatchCenter(); //调度单号生成 string newKeyId = SequenceService.CreateSequence("PC", CurrentUser.AccountComId); dispatch.KeyId = newKeyId; lblKeyId.Text = newKeyId; dispatch.FCompanyId = CurrentUser.AccountComId; dispatch.FBeginDate = dptBeginDate.SelectedDate; dispatch.FBeginTime = dpBeginTime.Text.Trim(); dispatch.FEndDate = dptEnd.SelectedDate; dispatch.FEndTime = dpEndTime.Text.Trim(); dispatch.FDate = DateTime.Now; dispatch.FVehicleNum = ddlFVehicleNum.SelectedValue; dispatch.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); dispatch.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); dispatch.CreateBy = CurrentUser.AccountName; dispatch.FFlag = 1; dispatch.FLogistics = ddlLogistics.SelectedText; dispatch.FLogisticsCode = ddlLogistics.SelectedValue; dispatch.FActual = string.IsNullOrEmpty(txtFActual.Text.Trim()) ? 0M : Convert.ToDecimal(txtFActual.Text.Trim()); dispatch.FTrailerPlate = ddlFTrailerPlate.SelectedValue; dispatch.FFrom = ddlFrom.SelectedValue; dispatch.FTo = ddlTo.SelectedValue; dispatch.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; dispatch.FAuditFlag = 0; DispatchCenterService.Add(dispatch); string[] keys = KeyId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] patch = patchid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string key in keys) { if (!string.IsNullOrEmpty(key)) { //状态 LHBillStatus flow = new LHBillStatus { KeyId = key, FCompanyId = CurrentUser.AccountComId, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FDate = Convert.ToDateTime(dptBeginDate.SelectedDate), FActionName = "配车", FMemo = string.Format(@"单据号{0}被{1}作配车业务处理。", key, CurrentUser.AccountName) }; BillStatusService.Add(flow); LHStockOut info = new StockOutService().FirstOrDefault(p => p.KeyId == key && p.FCompanyId == CurrentUser.AccountComId); if (info != null) { Dictionary <string, object> infoParms = new Dictionary <string, object>(); infoParms.Clear(); infoParms.Add("@keyid", info.FLogisticsNumber); infoParms.Add("@companyId", CurrentUser.AccountComId); infoParms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue); infoParms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray)); infoParms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray)); infoParms.Add("@FDispatchNum", newKeyId); //调度单号 SqlService.ExecuteProcedureCommand("proc_DispatchCenter", infoParms); } //变更单据上的司机、押韵员、车牌号 Dictionary <string, object> parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyid", key); parms.Add("@companyId", CurrentUser.AccountComId); parms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue); parms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray)); parms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray)); parms.Add("@FDispatchNum", newKeyId); //调度单号 SqlService.ExecuteProcedureCommand("proc_DispatchCenter", parms); List <LHStockOut> outs = new List <LHStockOut>(); List <LHPassCard> cards = new List <LHPassCard>(); } } foreach (var item in patch) { LHStockOutDispatch dis = StockoutDispatchServices.Where(p => p.KeyId == item).FirstOrDefault(); if (dis != null) { dis.FState = 1; StockoutDispatchServices.SaveChanges(); } } return(true); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var leaseReturn = LeaseReturnService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (leaseReturn != null) { ModifiedGrid(); leaseReturn.FCode = txtFCode.Text; leaseReturn.FName = tbxFCustomer.Text; leaseReturn.FAddress = txtFAddress.Text.Trim(); leaseReturn.FCompanyId = CurrentUser.AccountComId; leaseReturn.FFlag = 1; leaseReturn.FDeleteFlag = 0; leaseReturn.FLinkman = txtFLinkman.Text.Trim(); leaseReturn.FMemo = txtFMemo.Text.Trim(); leaseReturn.FPhone = txtFPhone.Text.Trim(); leaseReturn.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; leaseReturn.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; leaseReturn.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); leaseReturn.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); leaseReturn.FPaymentRentals = string.IsNullOrEmpty(txtFPaymentRentals.Text.Trim()) ? 0 : Convert.ToDecimal(txtFPaymentRentals.Text.Trim()); leaseReturn.FDepositSecurity = string.IsNullOrEmpty(txtFDepositSecurity.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDepositSecurity.Text.Trim()); leaseReturn.FSubjectCodeIn = ddlSubjectIn.SelectedValue; leaseReturn.FSubjectNameIn = ddlSubjectIn.SelectedText; leaseReturn.FSubjectCodeOut = ddlSubjectOut.SelectedValue; leaseReturn.FSubjectNameOut = ddlSubjectOut.SelectedText; leaseReturn.FSKNum = ""; leaseReturn.FCate = hfdClass.Text; leaseReturn.FFKNum = ""; LeaseReturnService.SaveChanges(); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", leaseReturn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var data = SqlService.ExecuteProcedureCommand("proc_LeaseReturnAmt", parms).Tables[0]; for (int i = 0; i < data.Rows.Count; i++) { int ids = Convert.ToInt32(data.Rows[i]["FDetailsFId"]); int qty = Convert.ToInt32(data.Rows[i]["Qty"]); var details = LeaseDetailsService.FirstOrDefault(p => p.FId == ids); details.FReturnQty = details.FReturnQty + qty; LeaseDetailsService.SaveChanges(); } if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TZ", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "8"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增租赁归还单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); //生成财务凭证 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", newKeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", hfdClass.Text); parmsAuto.Add("@date", Convert.ToDateTime(leaseReturn.FDate).ToString("yyyy-MM-dd")); parmsAuto.Add("@FSKNum", leaseReturn.FSKNum); parmsAuto.Add("@FAbstract", "退租"); SqlService.ExecuteProcedureCommand("proc_SFKLeaseReturnAuto", parmsAuto); } return(true); } return(false); }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); try { Log(string.Format(@"作废单据号:{0}成功。", selectIds)); using (var trans = new TransactionScope()) { // foreach (var ids in selectIds) { var status = new LHBillStatus(); status.FCompanyId = CurrentUser.AccountComId; status.FDeptId = CurrentUser.AccountOrgId; status.FDate = DateTime.Now; status.FOperator = CurrentUser.AccountName; status.FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided); status.KeyId = ids; status.FMemo = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName); GasHelper.AddBillStatus(status); } LeaseReturnService.Update(p => p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHLeaseReturn { FFlag = 0, // FStatus = Convert.ToInt32(GasEnumBillStauts.Voided), // FProgress = Convert.ToInt32(GasEnumBillStauts.Voided) }); foreach (var ids in selectIds) { var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", ids); parms.Add("@companyId", CurrentUser.AccountComId); var data = SqlService.ExecuteProcedureCommand("proc_LeaseKill", parms).Tables[0]; for (int i = 0; i < data.Rows.Count; i++) { int id = Convert.ToInt32(data.Rows[i]["FDetailsFId"]); int qty = Convert.ToInt32(data.Rows[i]["FBottleQty"]); var details = LeaseDetailsService.FirstOrDefault(p => p.FId == id); details.FReturnQty = details.FReturnQty - qty; LeaseDetailsService.SaveChanges(); } } trans.Complete(); } Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); var prod = StockInDetailsService.FirstOrDefault( p => p.KeyId == txtKeyId.Text && p.FCompanyId == CurrentUser.AccountComId); if (prod == null) { //生产产品入库 var product = new LHStockInDetails { KeyId = txtKeyId.Text, FItemCode = txtFCode.Text, FPrice = 0, FAmount = 0, FQty = Convert.ToDecimal(txtFQty.Text), FBottle = tbxFBottle.SelectedValue, FBottleQty = Convert.ToInt16(txtFBottleQty.Text), FBottleOweQty = 0, FCompanyId = CurrentUser.AccountComId, FCateId = 2000, FMemo = "生产入库", FCostPrice = Convert.ToDecimal(txtFCostPrice.Text), FBalance = Convert.ToDecimal(txtFBalance.Text), }; StockInDetailsService.Add(product); } else { prod.FItemCode = txtFCode.Text; prod.FQty = Convert.ToDecimal(txtFQty.Text); prod.FBottle = tbxFBottle.SelectedValue; prod.FBottleQty = Convert.ToInt32(txtFBottleQty.Text); prod.FCostPrice = Convert.ToDecimal(txtFCostPrice.Text); prod.FBalance = Convert.ToDecimal(txtFBalance.Text); StockInDetailsService.SaveChanges(); } //------------------------------------------------------------------- stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FMemo = txtFMemo.Text.Trim(); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FSurveyor = !ddlFSurveyor.SelectedValue.Equals("-1") ? ddlFSurveyor.SelectedText : ""; stock.FProducer = !ddlFProducer.SelectedValue.Equals("-1") ? ddlFProducer.SelectedText : "";//GasHelper.GetDropDownListArrayString(ddlFProducer.SelectedItemArray); stock.FBatchNumber = txtFBatchNumber.Text.Trim(); stock.FProductionWorkshop = ddlWorkShop.SelectedValue; stock.FCate = "内部"; stock.FCode = CurrentUser.AccountComId.ToString(CultureInfo.InvariantCulture); stock.FName = ""; stock.FDate = txtFDate.SelectedDate; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PR", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "6"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; var orders = new Dictionary <string, object>(); orders.Clear(); orders.Add("@KeyId", newKeyId); orders.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_ProuctOrder", orders); //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增生产单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var order = FkOrderCheckedService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (order != null) { //核销主单据 //-------------------------------------------------- order.FCode = txtFCode.Text; order.FName = tbxFCustomer.Text; //-------------------------------------------------- order.FDeleteFlag = 0; order.FMemo = txtFMemo.Text.Trim(); order.CreateBy = CurrentUser.AccountName; order.FDate = txtFDate.SelectedDate; //本次实际核销的金额 decimal checkedAmt = 0.00M; //收款单 decimal sksum = 0.00M; int[] sks = Grid1.SelectedRowIndexArray; for (int i = 0; i < sks.Length; i++) { sksum += Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2].ToString()); } if (sksum <= 0) { Alert.Show("要核销的收款单已核销完,暂无需核销单据。", MessageBoxIcon.Information); return(false); } //销售金额 decimal salesum = 0.00M; int[] sales = Grid2.SelectedRowIndexArray; for (int i = 0; i < sales.Length; i++) { salesum += Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1].ToString()); } if (sksum <= 0) { Alert.Show("要核销的发货单已核销完,暂无需核销单据。", MessageBoxIcon.Information); return(false); } if (sksum == salesum) { //实际核销款 checkedAmt = sksum; for (int i = 0; i < sks.Length; i++) { int id = Convert.ToInt32(Grid1.DataKeys[sks[i]][1].ToString()); string keyid = Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][0].ToString(); var banks = new LHFKOrderCheckedBanks(); banks.KeyId = txtKeyId.Text; banks.CBankId = id; banks.FAmt = Convert.ToDecimal(Grid1.DataKeys[sks[i]][2]); banks.FCompanyId = CurrentUser.AccountComId; var bank = FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (bank != null) { FkOrderCheckedBanksService.SaveChanges(); } else { FkOrderCheckedBanksService.Add(banks); } } for (int i = 0; i < sales.Length; i++) { string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString(); var details = new LHFKOrderCheckedDetails(); details.KeyId = txtKeyId.Text; details.FSaleKeyId = keyid; details.FAmount = Convert.ToDecimal(Grid2.DataKeys[sks[i]][1]); details.FCompanyId = CurrentUser.AccountComId; var detail = FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId) .FirstOrDefault(); if (detail != null) { FkOrderCheckedDetailsService.SaveChanges(); } else { FkOrderCheckedDetailsService.Add(details); } } } else if (sksum > salesum) { //实际核销款 checkedAmt = salesum; //分析 decimal kfpje = salesum; for (int i = 0; i < sks.Length; i++) { int id = Convert.ToInt32(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][1].ToString()); //string keyid = Grid1.DataKeys[sks[i]][0].ToString(); ///////////////////////////////////////////////// var sk = Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2]); decimal hxje = 0.00M; decimal yszj = sk; if (kfpje == 0) { hxje = 0; } else { decimal kyje = kfpje - yszj; if (kyje > 0) { hxje = yszj; kfpje = kyje; } else if (kyje == 0) { hxje = kfpje; kfpje = kyje; //continue; } else { hxje = kfpje; kfpje = 0; //continue; } } ///////////////////////////////////////////////// var banks = new LHFKOrderCheckedBanks(); banks.KeyId = txtKeyId.Text; banks.CBankId = id; banks.FCompanyId = CurrentUser.AccountComId; //本次核销款 banks.FAmt = hxje; var bank = FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId) .FirstOrDefault(); if (bank != null) { FkOrderCheckedBanksService.SaveChanges(); } else { FkOrderCheckedBanksService.Add(banks); } } ///////////////////////////////////////////////// decimal kfpje2 = salesum; for (int i = 0; i < sales.Length; i++) { string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString(); ////////////////////////////////////////////////////////// var sale = Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1]); decimal hxje = 0.00M; decimal yszj = sale; if (kfpje2 == 0) { hxje = 0; } else { decimal kyje = kfpje2 - yszj; if (kyje > 0) { hxje = yszj; kfpje2 = kyje; } else if (kyje == 0) { hxje = kfpje2; kfpje2 = kyje; //continue; } else { hxje = kfpje2; kfpje = 0; //continue; } } ///////////////////////////////////////////////////////// var details = new LHFKOrderCheckedDetails(); details.KeyId = txtKeyId.Text; details.FSaleKeyId = keyid; details.FAmount = hxje; details.FCompanyId = CurrentUser.AccountComId; var detail = FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId) .FirstOrDefault(); if (detail != null) { FkOrderCheckedDetailsService.SaveChanges(); } else { FkOrderCheckedDetailsService.Add(details); } } } else { //实际核销款 checkedAmt = sksum; //分析 decimal kfpje = sksum; for (int i = 0; i < sks.Length; i++) { int id = Convert.ToInt32(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][1].ToString()); //string keyid = Grid1.DataKeys[sks[i]][0].ToString(); ///////////////////////////////////////////////// var sk = Convert.ToDecimal(Grid1.DataKeys[Grid1.SelectedRowIndexArray[i]][2]); decimal hxje = 0.00M; decimal yszj = sk; if (kfpje == 0) { hxje = 0; } else { decimal kyje = kfpje - yszj; if (kyje > 0) { hxje = yszj; kfpje = kyje; } else if (kyje == 0) { hxje = kfpje; kfpje = kyje; //continue; } else { hxje = kfpje; kfpje = 0; //continue; } } ///////////////////////////////////////////////// var banks = new LHFKOrderCheckedBanks(); banks.KeyId = txtKeyId.Text; banks.CBankId = id; banks.FCompanyId = CurrentUser.AccountComId; //本次核销款 banks.FAmt = hxje; var bank = FkOrderCheckedBanksService.Where(p => p.KeyId == txtKeyId.Text && p.CBankId == id && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (bank != null) { FkOrderCheckedBanksService.SaveChanges(); } else { FkOrderCheckedBanksService.Add(banks); } } decimal kfpje2 = sksum; for (int i = 0; i < sales.Length; i++) { string keyid = Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][0].ToString(); ////////////////////////////////////////////////////////// var sale = Convert.ToDecimal(Grid2.DataKeys[Grid2.SelectedRowIndexArray[i]][1]); decimal hxje = 0.00M; decimal yszj = sale; if (kfpje2 == 0) { hxje = 0; } else { decimal kyje = kfpje2 - yszj; if (kyje > 0) { hxje = yszj; kfpje2 = kyje; } else if (kyje == 0) { hxje = kfpje2; kfpje2 = kyje; //continue; } else { hxje = kfpje2; kfpje = 0; //continue; } } var details = new LHFKOrderCheckedDetails(); details.KeyId = txtKeyId.Text; details.FSaleKeyId = keyid; details.FAmount = hxje; details.FCompanyId = CurrentUser.AccountComId; var detail = FkOrderCheckedDetailsService.Where(p => p.KeyId == txtKeyId.Text && p.FSaleKeyId == keyid && p.FCompanyId == CurrentUser.AccountComId) .FirstOrDefault(); if (detail != null) { FkOrderCheckedDetailsService.SaveChanges(); } else { FkOrderCheckedDetailsService.Add(details); } } } //----------------------------------------------------- //实际核销款 order.FAmount = checkedAmt; FkOrderCheckedService.SaveChanges(); //----------------------------------------------------- if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "HF", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "18"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增核销收款单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = BottleDetectionService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); ///////////////////////////////////////////////////////////////////////////// stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; //-------------------------------------------------- stock.FAddress = txtFAddress.Text.Trim(); stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FDate = txtFDate.SelectedDate; stock.FSalesman = ddlFSalesman.SelectedValue; stock.FArea = ddlFArea.SelectedValue; stock.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim()); stock.FDiscountAmount = string.IsNullOrEmpty(txtFDiscountAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDiscountAmount.Text.Trim()); stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = txtFLogisticsNumber.Text; stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FSubjectCode = ddlSubject.SelectedValue; stock.FSubjectName = ddlSubject.SelectedText; stock.FSKNum = ""; BottleDetectionService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "XS", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "1"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增钢瓶检测据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); var bottles = new Dictionary <string, object>(); bottles.Clear(); bottles.Add("@SalesKeyId", newKeyId); bottles.Add("@companyid", CurrentUser.AccountComId); bottles.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd")); SqlService.ExecuteProcedureCommand("proc_SalesReturnBottle", bottles); //收款部分 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", newKeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", "客户"); parmsAuto.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd")); parmsAuto.Add("@FSKNum", stock.FSKNum); SqlService.ExecuteProcedureCommand("proc_SKOrderAuto", parmsAuto); } if (!string.IsNullOrEmpty(hfdImage.Text)) { var attachment = new LHAttachment(); attachment.FCompanyId = CurrentUser.AccountComId; attachment.FPath = hfdImage.Text; attachment.KeyId = txtKeyId.Text; AttachmentService.Add(attachment); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = InitMonthServie.Where(p => p.KeyId == txtKeyId.Text.Trim()).FirstOrDefault(); if (stock != null) { ModifiedGrid(); ///////////////////////////////////////////////////////////////////////////// stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; //-------------------------------------------------- stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FMemo = txtFMemo.Text.Trim(); //var parms = new Dictionary<string, object>(); //parms.Clear(); //parms.Add("@keyID", stock.KeyId); //parms.Add("@companyId", CurrentUser.AccountComId); //var amt = // Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_MonthInitQty", parms).Tables[0].Rows[0][0]); stock.FAmount = Convert.ToDecimal(txtFAmount.Text); stock.FDate = txtFDate.SelectedDate; stock.FAmt = 0; stock.FCate = hfdUnit.Text; InitMonthServie.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TA", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "24"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增调整客户代码期初占用钢瓶单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); //stock.FClass = ddlFCate.SelectedValue; stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; stock.FAddress = txtFAddress.Text.Trim(); stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; if (!string.IsNullOrEmpty(txtFFreight.Text.Trim())) { stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); } stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FDate = txtFDate.SelectedDate; stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = tbxFLogisticsNumber.Text; stock.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim()); stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FSubjectCode = ddlSubject.SelectedValue; stock.FSubjectName = ddlSubject.SelectedText; stock.FDate = txtFDate.SelectedDate; #region T6 对接接口 //--------------------------------------------------------- //收发类型 stock.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; //部门名称 stock.FT6Department = ""; //部门代码 stock.FT6DepartmentNum = ""; //业务员代码 stock.FT6SalesmanNum = ""; //币种 stock.FT6Currency = ddlFT6Currency.SelectedValue; //汇率 stock.FT6ExchangeRate = Convert.ToDecimal(txtFT6ExchangeRate.Text); //销售类型 stock.FT6PurchaseType = ddlFT6PurchaseType.SelectedText; stock.FT6PurchaseTypeNum = ddlFT6PurchaseType.SelectedValue; //T6同步 stock.FT6Status = "未同步"; stock.FT6Warehouse = ddlWarehouse.SelectedValue; //--------------------------------------------------------- #endregion stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockInService.SaveChanges(); //订单出库 var passCard = PassCardService.Where(p => p.KeyId == tbxFLogisticsNumber.Text.Trim()).FirstOrDefault(); if (passCard != null) { passCard.FOutFlag = "已出库"; PassCardService.SaveChanges(); } if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "WC", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "4"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增采购单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); //付款部分 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", newKeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", "供应商"); parmsAuto.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd")); parmsAuto.Add("@FSKNum", string.IsNullOrEmpty(stock.FSKNum) ? "" : stock.FSKNum); SqlService.ExecuteProcedureCommand("proc_FKOrderAuto", parmsAuto); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FSalesman = ddlFSalesman.SelectedValue; stock.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; stock.FFreight = 0; stock.FLinkman = ""; stock.FMemo = txtFMemo.Text.Trim(); stock.FT6Warehouse = ddlFWarehouse.SelectedValue; stock.FT6Status = "未同步"; stock.FGroup = ddlFGroup.SelectedValue; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesReturnAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FDate = txtFDate.SelectedDate; stock.FCate = ddlFCate.SelectedValue; stock.FTime1 = DateTime.Now; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "IN", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "21"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增{2}单据。", newKeyId, CurrentUser.AccountName, ddlFCate.SelectedValue) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var lease = LeaseService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (lease != null) { ModifiedGrid(); lease.FCode = txtFCode.Text; lease.FName = tbxFCustomer.Text; lease.FAddress = txtFAddress.Text.Trim(); lease.FCompanyId = CurrentUser.AccountComId; lease.FFlag = 1; lease.FDeleteFlag = 0; lease.FFreight = string.IsNullOrEmpty(txtFFreight.Text.Trim()) ? 0 : Convert.ToDecimal(txtFFreight.Text.Trim()); lease.FLinkman = txtFLinkman.Text.Trim(); lease.FMemo = txtFMemo.Text.Trim(); lease.FPhone = txtFPhone.Text.Trim(); lease.FDate = txtFDate.SelectedDate; lease.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; lease.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@companyId", CurrentUser.AccountComId); parms.Add("@keyID", lease.KeyId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_LeaseAmt", parms).Tables[0].Rows[0][0]); lease.FAmount = amt; lease.FSalesman = ddlFSalesman.SelectedValue; lease.FArea = ddlFArea.SelectedValue; lease.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim()); lease.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; lease.FLogisticsNumber = txtFLogisticsNumber.Text; lease.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); lease.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); //发货单号 lease.FSalesNum = tbxFSalesNum.Text; lease.FSubjectCode = ddlSubject.SelectedValue; lease.FSubjectName = ddlSubject.SelectedText; lease.FSKNum = ""; lease.FCate = hfdClass.Text; LeaseService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "ZL", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "7"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增租赁单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); //收款部分 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", newKeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", hfdClass.Text); parmsAuto.Add("@date", Convert.ToDateTime(lease.FDate).ToString("yyyyMMdd")); parmsAuto.Add("@FSKNum", lease.FSKNum); parmsAuto.Add("@FAbstract", "收押金款"); SqlService.ExecuteProcedureCommand("proc_SKLeaseAuto", parmsAuto); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; stock.FAddress = txtFAddress.Text.Trim(); stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FFreight = 0;// Convert.ToDecimal(txtFFreight.Text.Trim()); stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); //stock.FDriver = !ddlFDriver.SelectedValue.Equals("-1") ? ddlFDriver.SelectedText : ""; stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; //stock.FSupercargo = !ddlFSupercargo.SelectedValue.Equals("-1") ? ddlFSupercargo.SelectedText : ""; stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesReturnAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = txtFLogisticsNumber.Text; stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FClass = ddlReturn.SelectedValue; LHCustomer custmernodel = new CustomerService().FirstOrDefault(p => p.FCode == txtFCode.Text.Trim()); if (custmernodel != null) { hfdCate.Text = "客户"; } else { hfdCate.Text = "供应商"; } stock.FCate = hfdCate.Text; stock.FDate = txtFDate.SelectedDate; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; stock.FTime1 = DateTime.Now; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "HK", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "13"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增空瓶回收单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockOutService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FOrgId = int.Parse(ddlOrgnization.SelectedValue); stock.FOrgName = ddlOrgnization.SelectedText; stock.FCode = ddlOrgnization.SelectedValue; stock.FName = ddlOrgnization.SelectedText.Trim(); //-------------------------------------------------- stock.FAuditFlag = 0; //stock.FAddress = txtFAddress.Text.Trim(); stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; //stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); stock.FLinkman = txtFLinkman.Text.Trim(); stock.FReceiver = ddlFReceiver.SelectedValue; stock.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; stock.FMemo = txtFMemo.Text.Trim(); stock.FT6Warehouse = ddlFWarehouse.SelectedValue; stock.FT6Status = "未同步"; //stock.FPhone = txtFPhone.Text.Trim(); //stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; //stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FTime1 = DateTime.Now; stock.FDate = txtFDate.SelectedDate; //stock.FSalesman = ddlFSalesman.SelectedValue; //stock.FArea = ddlFArea.SelectedValue; //stock.FAmt = Convert.ToDecimal(txtFAmt.Text.Trim()); //stock.FReconciliation = txtFReconciliation.Text; //stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; //stock.FLogisticsNumber = txtFLogisticsNumber.Text; //stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); //stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FCate = ddlFCate.SelectedValue; stock.FGroup = ddlFGroup.SelectedValue; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockOutService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "OT", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "20"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //-------------------------------------------------------------- //var orders = new Dictionary<string, object>(); //orders.Clear(); //orders.Add("@KeyId",newKeyId); //orders.Add("@companyId", CurrentUser.AccountComId); //SqlService.ExecuteProcedureCommand("proc_ProuctOrder", orders); //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增{2}单据。", newKeyId, CurrentUser.AccountName, ddlFCate.SelectedValue) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = LiquidPlanTaskService.Where(p => p.KeyId == txtKeyId.Text.Trim() && // p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; //-------------------------------------------------- stock.FAddress = txtFAddress.Text.Trim(); stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; stock.FDate = txtFDate.SelectedDate; stock.FSalesman = ddlFSalesman.SelectedValue; stock.FArea = ddlFArea.SelectedValue; stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = txtFLogisticsNumber.Text; stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FQty = Convert.ToDecimal(txtFQty.Text); stock.FPrice = Convert.ToDecimal(txtFPrice.Text); stock.FAmount = stock.FPrice * stock.FQty; stock.FItemCode = tbxFItemName.SelectedValue; stock.FItemName = tbxFItemName.SelectedText; LiquidPlanTaskService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "CC", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "29"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增发货单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); } if (!string.IsNullOrEmpty(hfdImage.Text)) { var attachment = new LHAttachment(); attachment.FCompanyId = CurrentUser.AccountComId; attachment.FPath = hfdImage.Text; attachment.KeyId = txtKeyId.Text; AttachmentService.Add(attachment); } return(true); } return(false); }