private void simpleButton6_Click(object sender, EventArgs e) { int[] rownumber = this.gridView采购订单列表.GetSelectedRows();//获取选中行号; if (rownumber.Length > 0) { fid_fs = new List <string>(); foreach (var sub in rownumber) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[sub]; if (icprbilldata.FSTATUS != 3) { } else { fid_fs.Add(icprbilldata.FID); } } if (fid_fs.Count > 0) { optType = "2"; if (!backgroundWorker2.IsBusy) { seButton(false); backgroundWorker2.RunWorkerAsync(); } } else { MsgHelper.ShowInformation("状态不可反审核!"); return; } } }
private void onSearch(v_lhproducts_policyModel where) { var action = new Action(() => { PageResult <v_lhproducts_policyModel> result = null; string countStr = $"第【{page}】页/共【{count}】页"; try { btnNext.Enabled = btnLast.Enabled = btn查询.Enabled = btn重置.Enabled = btnConfirm.Enabled = btnReturn.Enabled = false; result = _service.GetPolicyProducts(header, where, page, size); total = result.Total; count = total / size; count += total % size > 0 ? 1 : 0; countStr = $"第【{page}】页/共【{count}】页"; labCount.Text = countStr; gridControl.DataSource = result.Result; btnNext.Enabled = btnLast.Enabled = btn查询.Enabled = btn重置.Enabled = btnConfirm.Enabled = btnReturn.Enabled = true; } catch (Exception e) { MsgHelper.ShowInformation(e.Message); } }); var t1 = new ThreadStart(action); t1.Invoke(); }
private void simpleButton1_Click(object sender, EventArgs e) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[gridView采购订单列表.GetDataSourceRowIndex(gridView采购订单列表.FocusedRowHandle)]; /* * if (icprbilldata.FSTATUS != 5) * { * MsgHelper.ShowInformation("只有未关闭的订单才可进行此操作!"); * return; * } */ fid_close = icprbilldata.FID; optType = "4"; if (!backgroundWorker2.IsBusy) { seButton(false); backgroundWorker2.RunWorkerAsync(); } } else { MsgHelper.ShowInformation("请选择你要关闭的数据!"); } }
private void btnLogin_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; ApiService.APIServiceClient service = new ApiService.APIServiceClient("BasicHttpBinding_IAPIService", Global.WcfUrl); User user = service.Login(txtACC.Text, txtPAS.Text); if (user == null) { MsgHelper.ShowError("用户名或密码不正确!"); return; } Global.LoginUser = user; Hide(); if (_frmMain == null) { _frmMain = new FrmMainB(this); } { IniHelper.WriteString(Global.IniUrl, "CONFIG", "username", txtACC.Text); IniHelper.WriteString(Global.IniUrl, "CONFIG", "password", txtPAS.Text); _frmMain.Show(); } this.Cursor = Cursors.Default; } catch (Exception ex) { MsgHelper.ShowInformation(ex.Message); LogError(ex); } }
private void simpleButton5_Click(object sender, EventArgs e) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[gridView采购订单列表.GetDataSourceRowIndex(gridView采购订单列表.FocusedRowHandle)]; if (icprbilldata.FSTATUS != 1 && icprbilldata.FSTATUS != 4) { MsgHelper.ShowInformation("只有草稿或审核不通过的订单才可进行此操作!"); return; } fid_delete = icprbilldata.FID; optType = "5"; if (!backgroundWorker2.IsBusy) { seButton(false); backgroundWorker2.RunWorkerAsync(); } } else { MsgHelper.ShowInformation("请选择你要删除的数据!"); } }
private void btn直接发货_Click(object sender, EventArgs e) { try { if (gridView请购计划列表.FocusedRowHandle > -1) { int status = gridView请购计划列表.GetRowCellValue(gridView请购计划列表.FocusedRowHandle, "FSTATUS").ToInt(); if (status != 7) { MsgHelper.ShowInformation("单据未确认,无法发货!"); return; } var list = gridView请购计划列表.DataSource as V_ICPRBILLMODEL[]; FrmPPPImmediateSendGoods frm = new FrmPPPImmediateSendGoods(); frm.请购计划Data = list[gridView请购计划列表.GetDataSourceRowIndex(gridView请购计划列表.FocusedRowHandle)]; frm.请购计划明细Data = this.gridView请购计划明细.DataSource as hn.DataAccess.Model.V_ICPRBILLENTRYMODEL[]; frm.SaveAfter += Frm_SaveAfter1; frm.Show(); } else { MsgHelper.ShowInformation("请选择你要发货的数据!"); } } catch (Exception ex) { LogError(ex); } }
private void btn约车_Click(object sender, EventArgs e) { string ids = ""; List <string> list = new List <string>(); for (int i = 0; i < gridView发货计划列表.RowCount; i++) { bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i); var rowData = _dataSrouce[rowIndex]; //发货计划单处于草稿状态,并且约车状态为待发布的时候用户即可勾选多条记录进行约车 //if (rowData.FSTATUS == 1 && rowData.FCAR_STATUS == 1) if (rowData.FCAR_STATUS == 1) { list.Add(rowData.FID); } } } if (list.Count > 0) { _service.GroupContractCar(list.ToArray()); MsgHelper.ShowInformation("处理完成!"); this.onSearch(); } else { MsgHelper.ShowError("请选择要处理的数据!"); } }
private void btn反确认_Click(object sender, EventArgs e) { if (gridView请购计划列表.FocusedRowHandle > -1) { string fid = gridView请购计划列表.GetRowCellValue(gridView请购计划列表.FocusedRowHandle, "FID").ToString(); int status = gridView请购计划列表.GetRowCellValue(gridView请购计划列表.FocusedRowHandle, "FSTATUS").ToInt(); if (status == 7) { FrmPPPConfirm frm = new FrmPPPConfirm(fid, "unconfirm"); frm.ParentGridView = gridView请购计划列表; if (frm.ShowDialog() == DialogResult.OK) { this.onSearch(); } } else { MsgHelper.ShowInformation("只能反确认已确认的数据!"); } } else { MsgHelper.ShowInformation("请选择你要确认的数据!"); } }
private void btn刷新价格政策编号_Click(object sender, EventArgs e) { List <string> ids = new List <string>(); for (int i = 0; i < gridView请购计划明细.RowCount; i++) { bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr(); ids.Add(fid); } } if (ids.Count > 0) { _DataSource = _service.RefrshPriceNumberList(_icprbillid, ids.ToArray()); foreach (var model in _DataSource) { model.FCOMMITQTY = model.FORDERUNITQTY; } gridControl请购计划明细.DataSource = _DataSource; } else { MsgHelper.ShowInformation("请先勾选你要处理的数据"); } }
private void btn审核_Click(object sender, EventArgs e) { string ids = ""; List <string> list = new List <string>(); for (int i = 0; i < gridView发货计划列表.RowCount; i++) { bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i); var rowData = _dataSrouce[rowIndex]; if ((rowData.FSTATUS == 1 || rowData.FSTATUS == 2) && !string.IsNullOrEmpty(rowData.FBILLNO)) { list.Add(rowData.FID); } } } if (list.Count > 0) { ids = string.Join(",", list.ToArray()); } if (ids != "") { FrmAuditDialog dialog = new FrmAuditDialog("审核", "请选择你要做的处理", "通过", "不通过"); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.Yes) { //调用发货计划审核接口 int res = _service.AuditDeliveryByIDs(ids, 3, Global.LoginUser); MsgHelper.ShowInformation("处理成功!"); this.onSearch(); } else if (result == DialogResult.No) { //调用发货计划审核接口 int res = _service.AuditGroupByIDs(ids, 4, Global.LoginUser); MsgHelper.ShowInformation("处理成功!"); this.onSearch(); } foreach (var model in _dataSrouce) { foreach (string id in list) { if (model.FID == id) { model.FCHECK = true; } } } } else { MsgHelper.ShowError("审核只能针对待已审核和已生成单号的数据,请确认您选择数据是否正确!"); } }
private void btn删除_Click(object sender, EventArgs e) { string ids = ""; List <string> list = new List <string>(); for (int i = 0; i < gridView发货计划列表.RowCount; i++) { bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i); var rowData = _dataSrouce[rowIndex]; if (rowData.FSTATUS == 1 || rowData.FSTATUS == 2 || rowData.FSTATUS == 4 || rowData.FSTATUS == 6) { list.Add(rowData.FID); } } } if (list.Count > 0) { ids = string.Join(",", list.ToArray()); } if (ids != "") { if (MsgHelper.AskQuestion("确认要删除选中的单据,以及删除对应的其他关联信息吗?")) { //调用发货计划删除接口 int res = _service.DeleteGroupByIDs(ids); if (res > 0) { MsgHelper.ShowInformation("删除成功!"); this.onSearch(); } else if (res == -1) { MsgHelper.ShowInformation("已经生成发货计划的组柜计划无法生成。请先删除对应的发货计划!"); this.onSearch(); } } } else { MsgHelper.ShowError("请选择要删除的数据,只能删除未审核的数据"); } }
private void btn发货_Click(object sender, EventArgs e) { int status = ICPRBILLData.FSTATUS; if (status != 7) { MsgHelper.ShowInformation("单据未确认,无法发货!"); return; } FrmPPPImmediateSendGoods frm = new FrmPPPImmediateSendGoods(); frm.请购计划Data = this.ICPRBILLData; frm.请购计划明细Data = this.gridView请购计划明细.DataSource as hn.DataAccess.Model.V_ICPRBILLENTRYMODEL[]; frm.SaveAfter += Frm_SaveAfter; frm.Show(); }
private void btn反审_Click(object sender, EventArgs e) { string ids = ""; List <string> list = new List <string>(); for (int i = 0; i < gridView发货计划列表.RowCount; i++) { bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i); var rowData = _dataSrouce[rowIndex]; if (rowData.FSYNCSTATUS < 1) { list.Add(rowData.FID); } } } if (list.Count > 0) { ids = string.Join(",", list.ToArray()); } if (ids != "") { if (MsgHelper.AskQuestion("点击确认退回到待审核状态,可修改资料!")) { //调用发货计划删除接口 int res = _service.AuditAntiGroupByIDs(ids); if (res > 0) { MsgHelper.ShowInformation("处理成功!"); this.onSearch(); } } } else { MsgHelper.ShowError("反审核只能针对已审核并且未同步到厂家的数据,请先勾选您要处理的数据!"); } }
private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { setButton(true); if (tumMessage != "") { MsgHelper.ShowInformation(tumMessage); } else { if (optype == "0") { gridControl发货计划列表.DataSource = _dataSrouce; } else { this.onSearch(); } } }
string optType = "0";// /// <summary> /// 同步订单,异步执行 /// </summary> private void SyncOrder() { try { var rows = gridView采购订单列表.GetSelectedRows(); List <string> billnos = new List <string>(); foreach (var r in rows) { var billno = gridView采购订单列表.GetRowCellValue(r, "FBILLNO").ToString(); var desBillno = gridView采购订单列表.GetRowCellValue(r, "FDesBillNo"); if (desBillno != null) { MsgHelper.ShowInformation($"【{billno}】已同步,请勿重复提交"); return; } billnos.Add(billno); } if (billnos.Count > 0) { if (_service.SaleOrderUpload(billnos.ToArray())) { MsgHelper.ShowInformation("同步完成"); } ; } } catch (Exception exception) { MsgHelper.ShowInformation(exception.Message); } var action = new Action(() => { simpleButton3.Enabled = true; }); Invoke(action); }
private void btn重新组柜_Click(object sender, EventArgs e) { if (gridView发货计划列表.FocusedRowHandle > -1) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(gridView发货计划列表.FocusedRowHandle); var rowData = _dataSrouce[rowIndex]; //进入组柜编辑 FrmSGPGroupCounter frm = new FrmSGPGroupCounter(); frm.SaveAfter += new EventHandler(FrmPPPImmediateSendGoods_SaveAfter); frm.IcseoutbillModel = rowData; frm.Show(); //if (frm.ShowDialog() == DialogResult.OK) //{ // this.onSearch(); //} } else { MsgHelper.ShowInformation("请选择你要处理的数据!"); } }
private void btnConfirm_Click(object sender, EventArgs e) { try { if (txtOld.Text == "") { MsgHelper.ShowInformation("请输入旧密码!"); return; } if (txtNew1.Text == "") { MsgHelper.ShowInformation("请输入新密码!"); return; } if (txtNew1.Text != txtNew2.Text) { MsgHelper.ShowInformation("两次输入的密码不一致!"); return; } JsonMessage json = JsonHelper.ConvertToObject <JsonMessage>(_service.ModifyPassword(Global.LoginUser.FID, txtOld.Text, txtNew1.Text)); if (json.Success) { MsgHelper.ShowInformation("密码修改成功!"); DialogResult = DialogResult.OK; } else { MsgHelper.ShowError(json.Message); } } catch (Exception ex) { LogError(ex, GetType()); } }
private void btn反确认_Click(object sender, EventArgs e) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[gridView采购订单列表.GetDataSourceRowIndex(gridView采购订单列表.FocusedRowHandle)]; if (icprbilldata.FSTATUS != 7) { MsgHelper.ShowInformation("只有采购确认的订单才可反确认!"); return; } string fid = icprbilldata.FID; var listEntry = _service.GetOrderEntryList(fid, null); List <ICPOBILLENTRYMODEL> listICPO = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in listEntry) { ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL(); t.FENTRYID = sub.FENTRYID; t.FICPOBILLID = sub.FICPOBILLID; t.FID = sub.FID; listICPO.Add(t); } if (_service.ConfirmSave_ICPO("unconfirm", listICPO.ToArray(), Global.LoginUser)) { MsgHelper.ShowInformation("更新成功!"); onSearch(); } else { MsgHelper.ShowInformation("更新失败!"); } } else { MsgHelper.ShowInformation("请选择你要确认的数据!"); } }
private void gridView请购计划列表_MouseDown(object sender, MouseEventArgs e) { DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView采购订单列表.CalcHitInfo(new Point(e.X, e.Y)); if (e.Button == MouseButtons.Left && e.Clicks == 2) { //判断光标是否在行范围内 if (hInfo.InRow) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[gridView采购订单列表.GetDataSourceRowIndex(gridView采购订单列表.FocusedRowHandle)]; if (icprbilldata.FSTATUS != 1 && icprbilldata.FSTATUS != 4 && icprbilldata.FSTATUS != 0 && !(icprbilldata.FSTATUS == 3 && icprbilldata.FSYNCSTATUS == 4)) { MsgHelper.ShowInformation("当前状态不支持修改!"); return; } bool bzf = false; if (icprbilldata.FSYNCSTATUS == 4 || icprbilldata.FSTATUS == 3) { bzf = true; } FrmPurchaseOrder frm = new FrmPurchaseOrder(icprbilldata, bzf); if (bzf) { frm.Text = "采购订单作废"; } else { frm.Text = "采购订单修改"; } frm.SaveAfter += Frm_SaveAfter; frm.Show(); } } } }
private void btn保存_Click(object sender, EventArgs e) { // int count = 0; List <ICPRBILLENTRYMODEL> list = new List <ICPRBILLENTRYMODEL>(); for (int i = 0; i < gridView请购计划明细.RowCount; i++) { bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr(); string commitqty = gridView请购计划明细.GetRowCellValue(i, "FCOMMITQTY").ToStr(); string orderremark1 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK1").ToStr(); string orderremark2 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK2").ToStr(); list.Add(new ICPRBILLENTRYMODEL() { FID = fid, FCOMMITQTY = commitqty.ToDecimal(), FORDERREMARK1 = orderremark1, FORDERREMARK2 = orderremark2 }); if (list.Count == 50) { bool ret = _service.ConfirmSave("", list.ToArray(), Global.LoginUser); if (ret) { list = new List <ICPRBILLENTRYMODEL>(); } } } } _service.ConfirmSave("", list.ToArray(), Global.LoginUser); MsgHelper.ShowInformation("保存成功!"); }
private void btn采购确认_Click(object sender, EventArgs e) { List <ICPRBILLENTRYMODEL> list = new List <ICPRBILLENTRYMODEL>(); for (int i = 0; i < gridView请购计划明细.RowCount; i++) { bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr(); string commitqty = gridView请购计划明细.GetRowCellValue(i, "FCOMMITQTY").ToStr(); string orderremark1 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK1").ToStr(); string orderremark2 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK2").ToStr(); list.Add(new ICPRBILLENTRYMODEL() { FID = fid, FORDERREMARK1 = orderremark1, FORDERREMARK2 = orderremark2 }); } } if (list.Count > 0) { bool ret = _service.ConfirmSave("confirm", list.ToArray(), Global.LoginUser); if (ret) { MsgHelper.ShowInformation("采购确认保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } } else { MsgHelper.ShowInformation("请先勾选你要确认的数据!"); } }
private void btn约车变更_Click(object sender, EventArgs e) { if (gridView发货计划列表.FocusedRowHandle > -1) { var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(gridView发货计划列表.FocusedRowHandle); var rowData = _dataSrouce[rowIndex]; List <string> list = new List <string>(); list.Add(rowData.FID); if (list.Count > 0) { _service.GroupContractCar(list.ToArray()); MsgHelper.ShowInformation("处理完成!"); this.onSearch(); } else { MsgHelper.ShowError("请选择要处理的数据!"); } } }
private void cmbPromotionPolicy_MouseClick(object sender, MouseEventArgs e) { var header = new ICPOBILL_PolicyDTO(); header.Account = txt厂家账户.Text; header.BrandName = comBrand.SelectedItem is TB_BrandModel ? ((TB_BrandModel)comBrand.SelectedItem).FNAME : ""; header.OrderType = cmbOrderType.SelectedItem is SYS_SUBDICSMODEL ? ((SYS_SUBDICSMODEL)cmbOrderType.SelectedItem).FNUMBER : ""; header.OrderSubType = cmbBusinessType.SelectedItem is SYS_SUBDICSMODEL ? ((SYS_SUBDICSMODEL)cmbBusinessType.SelectedItem).FNUMBER : ""; header.Channel = cmbSaleChannel.SelectedItem is SYS_SUBDICSMODEL ? ((SYS_SUBDICSMODEL)cmbSaleChannel.SelectedItem).FNUMBER : ""; try { var policies = _service.GetPolicies(header); cmbPromotionPolicy.Text = ""; cmbPromotionPolicy.Properties.Items.Clear(); cmbPromotionPolicy.Properties.Items.AddRange(policies); cmbPromotionPolicy.ShowPopup(); } catch (Exception exception) { MsgHelper.ShowInformation(exception.Message); } }
private void btnBatchUpdate_Click(object sender, EventArgs e) { try { var indexs = BillGrid.GetSelectedRows(); if (indexs != null && indexs.Length > 0) { var lhodonos = new List <string>(); foreach (var i in indexs) { var no = BillGrid.GetRowCellValue(i, "LHODONO"); lhodonos.Add($"{no}"); } var megBills = _service.GetMergeBills(lhodonos.ToArray()); if (megBills.Length > 1) { MsgHelper.ShowInformation("已选单据不在同一分货单中,不能批量修改"); } FrmBatchOutBoundOrder frm = new FrmBatchOutBoundOrder(); frm.Result = megBills.SingleOrDefault(); frm.LHOBODNOS = lhodonos; if (frm.ShowDialog() == DialogResult.OK) { } } } catch (Exception exception) { MsgHelper.ShowException(exception); } }
private void AuditBill(AuditEnums auditType) { var userId = Global.LoginUser.FID; var indexs = gridView采购订单列表.GetSelectedRows(); List <string> billNos = new List <string>(); foreach (var i in indexs) { var billno = gridView采购订单列表.GetRowCellValue(i, "FBILLNO"); if (billno != null || !string.IsNullOrEmpty(billno.ToString())) { billNos.Add(billno.ToString()); } } if (billNos.Count > 0) { var msg = _service.AuditionICPOBILL(userId, billNos.ToArray(), auditType); onSearch(); MsgHelper.ShowInformation(msg); } }
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { tumMessage = ""; switch (optype) { case "0": try { _dataSrouce = _service.GetDeliveryList( Global.LoginUser, brand, xq == "全部" ? "" : xq, "", status, car, "", account, expresscompany, txt厂家单号.Text, txt发货计划单号.Text, txt组柜单号.Text, txt工程名称.Text, startdate == "0001/01/01" ? "" : startdate, enddate == "0001/01/01" ? "" : enddate, !chkClose.Checked); } catch (Exception ee) { tumMessage = ee.ToStr(); } break; case "2": try { FrmAuditDialog dialog = new FrmAuditDialog("审核", "请选择你要做的处理", "通过", "不通过"); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.Yes) { //调用发货计划审核接口 int res3 = _service.AuditDeliveryByIDs(ids_sh, 3, Global.LoginUser); MsgHelper.ShowInformation("处理成功!"); } else if (result == DialogResult.No) { //调用发货计划审核接口 int res2 = _service.AuditDeliveryByIDs(ids_sh, 4, Global.LoginUser); MsgHelper.ShowInformation("处理成功!"); } foreach (var model in _dataSrouce) { foreach (string id in list) { if (model.FID == id) { model.FCHECK = true; } } } } catch (Exception ee) { tumMessage = ee.ToStr(); } break; case "3": //调用发货计划删除接口 try { int res = _service.AuditAntiDeliveryByIDs(ids_sh); if (res > 0) { MsgHelper.ShowInformation("处理成功!"); } } catch (Exception ee) { tumMessage = ee.ToStr(); } break; case "4": //调用发货计划接口 try { fid_tb.Clear(); for (int k = 0; k < listModels.Count; k++) { V_ICSEOUTBILLMODEL rowData = listModels[k]; List <MApiModel.api12.Datum> LItem = new List <MApiModel.api12.Datum>(); var entryList = _service.GetDeliveryEntryList(rowData.FID); foreach (var sub22 in entryList) { v_thdModel v = _service.getTHD(sub22.thdbm); sub22.khmc = v.khmc; sub22.khhm = v.khhm; sub22.gg = v.cpgg; sub22.xh = v.cpxh; sub22.pz = v.cppz; sub22.dw = v.dw; sub22.dj = v.dj; sub22.pz = v.cppz; sub22.xh = v.cpxh; sub22.gg = v.cpgg; sub22.khhm = v.khhm; sub22.khmc = v.khmc; sub22.cpdj = v.cpdj; sub22.pzhm = v.pzhm; sub22.kdrq = v.rq.ToString("yyyy-MM-dd"); sub22.cpcm = v.cpcm; sub22.cpsh = v.cpsh; } string comid = "2"; foreach (var subEntry in entryList) { v_thdModel vTHD = _service.getTHD(subEntry.thdbm); comid = vTHD.DB; //list.Add(rowData.FID); MApiModel.api12.Datum subItem = new MApiModel.api12.Datum(); subItem.pzhm = rowData.FBILLNO.Replace("DP", ""); subItem.rq = rowData.FBILLDATE.Year + "/" + (rowData.FBILLDATE.Month < 10 ? "0" + rowData.FBILLDATE.Month.ToStr() : rowData.FBILLDATE.Month.ToStr()) + "/" + (rowData.FBILLDATE.Day < 10 ? "0" + rowData.FBILLDATE.Day.ToStr() : rowData.FBILLDATE.Day.ToStr()); subItem.khhm = vTHD.khhm; subItem.khmc = vTHD.khmc; subItem.pzlb = ""; subItem.cplb = 0; //subItem.pjhm = string.IsNullOrEmpty(rowData.thdbm)?"":rowData.thdbm; subItem.zdr = "300384"; subItem.pjhm = string.IsNullOrEmpty(vTHD.pzhm) ? "" : vTHD.pzhm; // string[] strArr = pro.FSRCCODE.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); //产品品种 subItem.cppz = vTHD.cppz; //产品规格 subItem.cpgg = vTHD.cpgg; //产品型号 subItem.cpxh = vTHD.cpxh; subItem.cpdj = vTHD.cpdj; subItem.cpsh = string.IsNullOrEmpty(vTHD.cpsh) ? "" : vTHD.cpsh; // string.IsNullOrEmpty(subEntry.FCOLORNO)?"":subEntry.FCOLORNO; subItem.cpcm = string.IsNullOrEmpty(vTHD.cpcm) ? "" : vTHD.cpcm; // string.IsNullOrEmpty(subEntry.FSTOCKNUMBER)?0:int.Parse(subEntry.FSTOCKNUMBER); subItem.package = vTHD.tpackage; subItem.dw = vTHD.dw; subItem.ks = int.Parse(vTHD.ks); subItem.sl = (int)subEntry.FCOMMITQTY; subItem.bz = string.IsNullOrEmpty(subEntry.FREMARK) ? "" : subEntry.FREMARK; subItem.gg = vTHD.gg == null ? "" : vTHD.gg; try { decimal dGGS = subItem.ks * subItem.sl * decimal.Parse(vTHD.gg); subItem.ggs = dGGS.ToStr(); } catch { subItem.ggs = vTHD.GGS == null ? "" : vTHD.GGS; } subItem.pjhm1 = ""; // //subItem.package = vTHD.tpackage; subItem.pjhm2 = ""; subItem.telphone = string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "123456789" : rowData.FDELIVERERTEL; string strCarno = ""; strCarno += string.IsNullOrEmpty(rowData.FCARNUMBER) ? "" : rowData.FCARNUMBER; strCarno += string.IsNullOrEmpty(rowData.FDELIVERER) ? "" : " 司机:" + rowData.FDELIVERER; strCarno += string.IsNullOrEmpty(rowData.FDELIVERERTEL) ? "" : " 电话:" + rowData.FDELIVERERTEL; decimal dLength = decimal.Parse(IniHelper.ReadString(Global.IniUrl, "CONFIG", "cph", "40")); if (strCarno.Length > (int)dLength) { strCarno = strCarno.Substring(0, (int)dLength - 1); } subItem.carno = strCarno.Trim().Replace(" ", ""); subItem.jsdz = string.IsNullOrEmpty(rowData.FRECEIVER_DISTRICT_NAME) ? "广东省" : rowData.FRECEIVER_DISTRICT_NAME; subItem.jsr = subItem.telphone; subItem.pjhm3 = rowData.FBILLNO.Replace("DP", ""); subItem.ysfs = string.IsNullOrEmpty(rowData.FDELIVERY_METHODNAME) ? "" : rowData.FDELIVERY_METHODNAME; subItem.jsfs = ""; subItem.Province = string.IsNullOrEmpty(rowData.FRECEIVER_PROVINCE_NAME) ? "广东省" : rowData.FRECEIVER_PROVINCE_NAME; subItem.City = string.IsNullOrEmpty(rowData.FRECEIVER_CITY_NAME) ? "佛山市" : rowData.FRECEIVER_CITY_NAME; subItem.Region = "南海区"; subItem.bz = string.IsNullOrEmpty(rowData.FREMARK) ? "" : rowData.FREMARK; LItem.Add(subItem); } if (LItem.Count > 0) { MApiModel.api12.Rootobject getapi6 = new MApiModel.api12.Rootobject(); getapi6.data = LItem.ToArray(); getapi6.comid = int.Parse(comid); string fid = rowData.FID; if (!fid_tb.ContainsKey(fid) && fid != "") { fid_tb.Add(fid, getapi6); } } } List <string> listFalse = new List <string>(); int iIndex = 0; List <string> listKeys = new List <string>(); foreach (var sub333 in fid_tb) { listKeys.Add(sub333.Key); } foreach (string sub33 in listKeys) { if (!fid_tb.ContainsKey(sub33)) { continue; } iIndex++; string k = sub33; MApiModel.api12.Rootobject v = fid_tb[sub33]; var jsonData = JsonHelper.ToJson(v); string res1 = _service.SyncDeliveryByIDsMN(jsonData, k); if (res1 == "1") { //MsgHelper.ShowInformation("处理完成!"); } else { listFalse.Add("第" + iIndex + "条发生错误:" + res1); } } if (listFalse.Count > 0) { string mes = ""; foreach (var sub in listFalse) { mes += sub + "\r\n"; } MsgHelper.ShowError(mes); } } catch (Exception ee) { tumMessage = ee.ToStr(); } break; } }
private void btn保存_Click(object sender, EventArgs e) { string closereson = ""; if (IsRowClose) { if (!MsgHelper.AskQuestion("确定要关闭选择的明细行吗?")) { return; } FrmInput input = new FrmInput(); if (input.ShowDialog() != DialogResult.OK) { return; } closereson = input.Content; } int count = 0; List <ICPRBILLENTRYMODEL> list = new List <ICPRBILLENTRYMODEL>(); for (int i = 0; i < gridView请购计划明细.RowCount; i++) { bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr(); //string commitqty = gridView请购计划明细.GetRowCellValue(i, "FCOMMITQTY").ToStr(); string orderremark1 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK1").ToStr(); string orderremark2 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK2").ToStr(); list.Add(new ICPRBILLENTRYMODEL() { FID = fid, FORDERREMARK1 = orderremark1, FORDERREMARK2 = orderremark2 }); if (list.Count == 50) { bool ret = _service.CloseSave(list.ToArray(), Global.LoginUser, closereson); if (ret) { list = new List <ICPRBILLENTRYMODEL>(); } } count++; } } _service.UpdateICPRBILL(new ICPRBILLMODEL() { FID = _icprbillid, FIDENTIFICATION = txt标识.Text }); if (SaveAfter != null) { SaveAfter(null, null); } if (list.Count == 0) { this.Close(); //MsgHelper.ShowError("请勾选要处理的数据!"); return; } if (IsRowClose) { if (MsgHelper.AskQuestion("确定要关闭选择的明细行吗?")) { bool ret = _service.CloseSave(list.ToArray(), Global.LoginUser, closereson); if (ret) { MsgHelper.ShowInformation("处理成功!"); this.DialogResult = DialogResult.OK; } } } else { bool ret = _service.ConfirmSave("", list.ToArray(), Global.LoginUser); if (ret) { MsgHelper.ShowInformation("保存成功!"); //this.Close(); } } }
string optType = "0";// private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { tuMessage = ""; switch (optType) { case "0": try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } break; case "1": //shenhe try { foreach (var sub111 in fid_sh) { var listEntry = _service.GetOrderEntryList(sub111, null); List <ICPOBILLENTRYMODEL> listICPO = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in listEntry) { ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL(); t.FENTRYID = sub.FENTRYID; t.FICPOBILLID = sub.FICPOBILLID; t.FID = sub.FID; listICPO.Add(t); } if (_service.AuditSave_ICPO(listICPO.ToArray(), Global.LoginUser, "")) { // MsgHelper.ShowInformation("审核成功!"); try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } } else { //MsgHelper.ShowInformation("审核失败!"); } } } catch (Exception ee) { tuMessage = ee.ToStr(); } break; case "2": try { foreach (var sub11 in fid_fs) { var listEntry1 = _service.GetOrderEntryList(sub11, null); List <ICPOBILLENTRYMODEL> listICPO1 = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in listEntry1) { ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL(); t.FENTRYID = sub.FENTRYID; t.FICPOBILLID = sub.FICPOBILLID; t.FID = sub.FID; listICPO1.Add(t); } if (_service.UnAuditSave_ICPO(listICPO1.ToArray(), Global.LoginUser, "")) { // MsgHelper.ShowInformation("反审成功!"); try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } } else { MsgHelper.ShowInformation("反审失败!"); } } } catch (Exception ee) { tuMessage = ee.ToStr(); } break; case "3": try { ApiService.APIServiceClient mapi = new ApiService.APIServiceClient(); foreach (var sub22 in fid_tb) { string s = mapi.Remote_InsertICPOEntry(sub22.Value); if (!s.Contains("error")) { Dictionary <int, string> dicEntryID_THDBMDetail = new Dictionary <int, string>(); try { MApiModel.api24.Rootobject api24 = new MApiModel.api24.Rootobject(); api24.action = "getMN_cp_24"; api24.token = ""; DateTime theTime = DateTime.Now; string rq1 = theTime.Year + "/" + (theTime.Month < 10 ? "0" + theTime.Month.ToStr() : theTime.Month.ToStr()) + "/" + (theTime.Day < 10 ? "0" + theTime.Day.ToStr() : theTime.Day.ToStr()); api24.rq1 = rq1; api24.rq2 = rq1; api24.pageIndex = 1; api24.pageSize = 200; api24.pzhm = s; MApiModel.recApi24.Rootobject r24 = new MApiModel.recApi24.Rootobject(); r24 = _service.Remote_Get24(api24); Regex reg = new Regex("(\\d+)"); foreach (var subb in r24.resultInfo) { if (!string.IsNullOrEmpty(subb.khhm1) && reg.IsMatch(subb.khhm1)) { int iEndtry = int.Parse(reg.Match(subb.khhm1).Groups[1].Value); if (dicEntryID_THDBMDetail.ContainsKey(iEndtry)) { dicEntryID_THDBMDetail.Add(iEndtry, subb.autoid); } } } } catch (Exception ee) { Console.WriteLine(ee.Message); } _service.Update_FSYN_Remote_Status(sub22.Key, 4, s, dicEntryID_THDBMDetail); MsgHelper.ShowInformation("同步完毕!"); try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } } else { MsgHelper.ShowError(s); } } } catch (Exception ee) { tuMessage = ee.ToStr(); } break; case "4": var listEntry5 = _service.GetOrderEntryList(fid_close, null); List <ICPOBILLENTRYMODEL> listICPO5 = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in listEntry5) { ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL(); t.FENTRYID = sub.FENTRYID; t.FICPOBILLID = sub.FICPOBILLID; t.FID = sub.FID; listICPO5.Add(t); } if (_service.CloseSave_ICPO(listICPO5.ToArray(), Global.LoginUser, "")) { MsgHelper.ShowInformation("关闭成功!"); try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } } else { MsgHelper.ShowInformation("关闭失败!"); } break; case "5": if (_service.Delete_ICPO(fid_delete)) { MsgHelper.ShowInformation("删除成功!"); try { listSearch = _service.GetOrderList( Global.LoginUser, "", query.brand, int.Parse((query.t_status == null ? "0" : query.t_status)), "", query.P_BillNo, query.startTime.ToString(), query.endTime.ToStr(), !query.bClose); } catch (Exception ee) { tuMessage = ee.ToString(); } } else { MsgHelper.ShowInformation("删除失败!"); } break; case "6": try { listDetail = _service.GetOrderEntryList(fid_detail, null); } catch (Exception ee) { tuMessage = ee.ToString(); } break; } }
private void simpleButton3_Click(object sender, EventArgs e) { test(); fid_tb.Clear(); int[] rownumber = this.gridView采购订单列表.GetSelectedRows();//获取选中行号; if (rownumber.Length > 0) { foreach (var sub11 in rownumber) { if (gridView采购订单列表.FocusedRowHandle > -1) { var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; var icprbilldata = list[sub11]; if (icprbilldata.FSTATUS != 3) { // MsgHelper.ShowInformation("只有审核过的订单才可同步厂家!"); continue; } if (icprbilldata.FSYNCSTATUS != 0) { //MsgHelper.ShowInformation("该订单不可同步到厂家!"); continue; } string fid = icprbilldata.FID; var listEntry = _service.GetOrderEntryList(fid, null); List <ICPOBILLENTRYMODEL> listICPO = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in listEntry) { if (listICPO.Any(x => x.FITEMID == sub.FITEMID)) { ICPOBILLENTRYMODEL theOne = listICPO.First(x => x.FITEMID == sub.FITEMID); theOne.FSRCQTY += (int)sub.FSRCQTY; } else { ICPOBILLENTRYMODEL t = new ICPOBILLENTRYMODEL(); t.FentryTotal = listEntry.Count(); t.FENTRYID = sub.FENTRYID; t.FITEMID = sub.FITEMID; t.Flevel = sub.Flevel; t.FCOLORNO = sub.FCOLORNO; t.FcontractNO = sub.FcontractNO; t.Funit = sub.Funit; t.FAUDQTY = sub.FAUDQTY; t.FPRICE = sub.FPRICE; t.Famount = sub.Famount; t.FREMARK = sub.FREMARK; t.FSRCQTY = (int)sub.FSRCQTY; listICPO.Add(t); } } ICPOBILLMODEL tempBillModel = icprbilldata; Regex regInt = new Regex("(\\d+)"); string strHM = ""; string strMC = ""; string comid = ""; V_CLIENTACCOUNTModel singleDic = _service.GetClientAccountSingle(icprbilldata.FCLIENTID); if (singleDic == null) { MsgHelper.ShowInformation("客户号码为空,不可同步!"); return; } else { try { strHM = regInt.Match(singleDic.FACCOUNT).Groups[1].Value; strMC = singleDic.FNAME; if (singleDic.FACCOUNT.Contains("FDK")) { comid = "10"; } else if (singleDic.FACCOUNT.Contains("MN")) { comid = "2"; } else if (singleDic.FACCOUNT.Contains("GW")) { comid = "3"; } } catch { } } if (string.IsNullOrEmpty(strHM)) { MsgHelper.ShowInformation("客户号码为空,不可同步!"); return; } MApiModel.api3.Rootobject api3 = new MApiModel.api3.Rootobject(); api3.action = "setMN_cp_24"; api3.token = ""; api3.comid = comid; List <MApiModel.api3.Datum> listSubItems = new List <MApiModel.api3.Datum>(); foreach (var sub in listICPO) { ProductViewModel pro = _service.getProductView(sub.FITEMID); MApiModel.api3.Datum subItem = new MApiModel.api3.Datum(); subItem.sourceno = tempBillModel.FBILLNO; subItem.rq = tempBillModel.FBILLDATE.Year + "/" + tempBillModel.FBILLDATE.Month + "/" + tempBillModel.FBILLDATE.Day; // subItem.comid = "101"; subItem.khhm = strHM; subItem.khmc = strMC; subItem.pjhm = tempBillModel.FprojectNO; subItem.zdr = "300384"; ///////////////////////////////////////////////////// string[] strArr = pro.FSRCCODE.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); //产品品种 subItem.cppz = (strArr.Length == 3 ? strArr[0] : ""); //产品规格 subItem.cpgg = (strArr.Length == 3 ? strArr[2] : ""); //产品型号 subItem.cpxh = (strArr.Length == 3 ? strArr[1] : ""); subItem.cpdj = sub.Flevel == null ? "1" : sub.Flevel; subItem.cpsh = string.IsNullOrEmpty(sub.FCOLORNO) ? "" : sub.FCOLORNO; //产品仓号 subItem.cpcm = string.IsNullOrEmpty(sub.FstockNO) ? "" : sub.FstockNO; // subItem.package = sub.FcontractNO subItem.dw = string.IsNullOrEmpty(pro.FSRCUNIT) ? "" : pro.FSRCUNIT; //包装片数 subItem.ks = (int)decimal.Parse(pro.FPKGFORMAT); subItem.sl = (int)sub.FSRCQTY; subItem.dj = sub.FPRICE; subItem.je = subItem.sl * subItem.dj;//(int)sub.Famount; subItem.khhm1 = sub.FENTRYID.ToStr(); subItem.bz = sub.FREMARK; listSubItems.Add(subItem); } api3.data = listSubItems.ToArray(); //api3.data = listSubItems; optType = "3"; string fid1 = tempBillModel.FID; if (!fid_tb.ContainsKey(fid1)) { fid_tb.Add(fid1, api3); } } else { } } if (fid_tb.Count > 0) { optType = "3"; if (!backgroundWorker2.IsBusy) { seButton(false); backgroundWorker2.RunWorkerAsync(); } } else { MsgHelper.ShowInformation("请选择你要确认的数据!"); } } }
private void btn采购确认_Click(object sender, EventArgs e) { int count = 0; List <ICPRBILLENTRYMODEL> list = new List <ICPRBILLENTRYMODEL>(); for (int i = 0; i < gridView请购计划明细.RowCount; i++) { bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool(); if (b) { string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr(); string commitqty = gridView请购计划明细.GetRowCellValue(i, "FCOMMITQTY").ToStr(); string orderremark1 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK1").ToStr(); string orderremark2 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK2").ToStr(); list.Add(new ICPRBILLENTRYMODEL() { FID = fid, FCOMMITQTY = commitqty.ToDecimal(), FORDERREMARK1 = orderremark1, FORDERREMARK2 = orderremark2, FCONFIRM_USER = Global.LoginUser.FID, FCONFIRM_TIME = DateTime.Now }); if (list.Count == 50) { bool ret = _service.ConfirmSave(_Action, list.ToArray(), Global.LoginUser); if (ret) { list = new List <ICPRBILLENTRYMODEL>(); } } count++; } } //if (list.Count > 0) //{ // bool ret = _service.ConfirmSave(_Action, list.ToArray(), Global.LoginUser); // if (ret) // { // MsgHelper.ShowInformation("处理成功!"); // this.DialogResult = DialogResult.OK; // this.Close(); // } //} if (count == 0) { MsgHelper.ShowInformation("请先勾选你要确认的数据!"); } else { bool ret = _service.ConfirmSave(_Action, list.ToArray(), Global.LoginUser); if (ret) { MsgHelper.ShowInformation("处理成功!"); } //var fplanId = list.First().FID; // 更新计划单的采购确认时间----2019-08-05 //_service.UpdateConfirmTime(fplanId); this.DialogResult = DialogResult.OK; this.Close(); } }