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 simpleButton2_Click(object sender, EventArgs e) { #region 旧代码,弃用 //int[] rownumber = this.gridView采购订单列表.GetSelectedRows();//获取选中行号; //if (rownumber.Length > 0) //{ // fid_sh = new List<string>(); // foreach (var sub in rownumber) // { // var list = gridView采购订单列表.DataSource as V_ICPOBILLMODEL[]; // var icprbilldata = list[sub]; // if (icprbilldata.FSTATUS != 0 && icprbilldata.FSTATUS != 1 && icprbilldata.FSTATUS != 2 && icprbilldata.FSTATUS != 4) // { // // MsgHelper.ShowInformation("当前状态不可审核!"); // // return; // } // else // fid_sh.Add(icprbilldata.FID); // } // if (fid_sh.Count > 0) // { // optType = "1"; // if (!backgroundWorker2.IsBusy) // { // seButton(false); // backgroundWorker2.RunWorkerAsync(); // } // } // else // { // MsgHelper.ShowInformation("状态不可审核!"); // return; // } //} #endregion FrmAuditDialog frm = new FrmAuditDialog("审核单据", "请对所选单据进行操作", "审核通过", "审核不通过"); var result = frm.ShowDialog(); if (result == DialogResult.Yes || result == DialogResult.No) { var auditType = result == DialogResult.Yes ? AuditEnums.审核通过 : AuditEnums.审核不通过; AuditBill(auditType); } }
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 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 { foreach (var sub33 in fid_tb) { string res1 = _service.SyncDeliveryByIDsMN(JSONhelper.ToJson(sub33.Value), sub33.Key); if (res1 == "1") { //MsgHelper.ShowInformation("处理完成!"); } else { MsgHelper.ShowError(res1); } } } catch (Exception ee) { tumMessage = ee.ToStr(); } break; } }