public bool UnAuditSave_ICPO(List <ICPOBILLENTRYMODEL> data, User loginUser, string content) { try { foreach (ICPOBILLENTRYMODEL model in data) { ICPOBILLENTRYMODEL uptModel = ICPOBILLENTRYDAL.Instance.Get(model.FID); if (uptModel != null) { uptModel.FSTATUS = (int)Constant.ICPOBILL_FSTATUS.草稿; ICPOBILLENTRYDAL.Instance.Update(uptModel); ICPOBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = (int)Constant.ICPOBILL_FSTATUS.草稿 }, new { FID = uptModel.FICPOBILLID }); } } return(true); } catch (Exception ex) { LogHelper.WriteLog(ex); throw ex; } }
public bool Remote_InsertICPOEntry(ICPOBILLMODEL billModel, ICPOBILLENTRYMODEL entryModel) { MApiAccess.AccessApi Mapi = new MApiAccess.AccessApi(); if (string.IsNullOrEmpty(Global.g_token.tokenInfo.endDate) || DateTime.Parse(Global.g_token.tokenInfo.endDate) < DateTime.Now) { MApiModel.api1.Rootobject tempToken = new MApiModel.api1.Rootobject(); tempToken.comid = 101; tempToken.action = "getToken"; tempToken.khhm = "300384"; tempToken.openkey = "10011630"; Global.g_token = Mapi.AccessApi1(tempToken); } MApiModel.api3.Rootobject api3 = new MApiModel.api3.Rootobject(); api3.action = "setMN_cp_24"; api3.token = Global.g_token.token; List <MApiModel.api3.Datum> listSubItems = new List <MApiModel.api3.Datum>(); MApiModel.api3.Datum subItem = new MApiModel.api3.Datum(); subItem.sourceno = billModel.FBILLNO; subItem.rq = billModel.FDATESTR; subItem.comid = "101"; //subItem.khhm = billModel.Fcompany; //subItem.khmc= //subItem.pjhm = ""; subItem.zdr = billModel.FBILLER; //产品品种 //subItem.cppz=billModel //产品规格 //subItem.cpgg = ""; //产品型号 subItem.cpxh = ""; subItem.cpdj = entryModel.Flevel; subItem.cpsh = entryModel.FCOLORNO; //产品仓号 subItem.cpcm = entryModel.FstockNO; subItem.package = entryModel.FcontractNO; subItem.dw = entryModel.Funit; //包装片数 //subItem.ks=entryModel. subItem.sl = int.Parse(entryModel.FSRCQTY.ToString()); subItem.je = int.Parse(entryModel.Famount.ToString()); listSubItems.Add(subItem); api3.data = listSubItems.ToArray(); MApiModel.recApi3.Rootobject recapi3 = Mapi.AccessApi3(api3); if (recapi3.status == 0) { return(true); } else { return(false); } }
/// <summary> /// 采购确认,要同时更新请购单 /// </summary> /// <param name="data"></param> /// <returns></returns> public bool ConfirmSave_ICPO(string action, List <ICPOBILLENTRYMODEL> data, User loginUser) { try { List <ICPRBILLENTRYMODEL> tempPRList = new List <ICPRBILLENTRYMODEL>(); foreach (ICPOBILLENTRYMODEL model in data) { ICPRBILLENTRYMODEL tempPR = ICPRBILLENTRYDAL.Instance.Get(model.FPLANID); if (tempPR != null) { tempPRList.Add(tempPR); } ICPOBILLENTRYMODEL uptModel = ICPOBILLENTRYDAL.Instance.Get(model.FID); if (uptModel != null) { if (action == "confirm") { uptModel.FSTATUS = (int)Constant.ICPOBILL_FSTATUS.采购确认; } else if (action == "unconfirm") { uptModel.FSTATUS = (int)Constant.ICPOBILL_FSTATUS.审核通过; } LogHelper.WriteLog(JsonHelper.ToJson(uptModel)); ICPOBILLENTRYDAL.Instance.Update(uptModel); if (action == "unconfirm") { ICPOBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = (int)Constant.ICPOBILL_FSTATUS.审核通过 }, new { FID = uptModel.FICPOBILLID }); } else { if (ICPOBILLENTRYDAL.Instance.GetConfirmStatus(uptModel.FID) == 0) { ICPOBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = (int)Constant.ICPOBILL_FSTATUS.采购确认 }, new { FID = uptModel.FICPOBILLID }); } } } } if (tempPRList.Count > 0) { ConfirmSave(action, tempPRList, loginUser); } return(true); } catch (Exception ex) { LogHelper.WriteLog(ex); throw ex; } }
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("请选择你要确认的数据!"); } }
/// <summary> /// 保存 /// </summary> private void simpleButton3_Click(object sender, EventArgs e) { #region 1、保存前检验 if (SaveCheck()) { return; } #endregion #region 2、需要保存的数据定义 List <ICPOBILLENTRYMODEL> listSub = new List <ICPOBILLENTRYMODEL>(); List <V_ICPOBILLENTRYMODEL> list = gridControl采购订单明细.DataSource as List <V_ICPOBILLENTRYMODEL>; ICPOBILLMODEL tBill = _service.GetSingleOrder(model.FID) ?? new ICPOBILLMODEL(); // 查询出来的没有FID #endregion #region 3、形成主表数据 ///经营场所 var mcu = labMCU.Tag as TB_PREMISE_GRIDVIEW_DTO; if (mcu != null) { tBill.FPREMISEID = mcu.FID; } tBill.FTRANSTYPE = "0"; tBill.FBRANDID = (comBrand.SelectedItem as TB_BrandModel).FID; tBill.FCLIENTID = txt厂家账户.Tag.ToStr(); tBill.FDATE = dateDatetime.DateTime; tBill.FBILLNO = txtBillNO.Text; tBill.FBILLERNAME = txtCreater.Text; tBill.FBILLER = txtCreater.Tag.ToStr(); tBill.FSTATE = 1;//草稿 tBill.Fnote = txtRemarks.Text; tBill.FprojectNO = txtProjectNo.Text; if (searchDic105.Tag != null) { tBill.FPOtype = searchDic105.Tag.ToString(); } if (cmbPromotionPolicy.SelectedItem is LH_Policy) { tBill.Fpricepolicy = (cmbPromotionPolicy.SelectedItem as LH_Policy).Id; } //新加 tBill.LH_ORDERTYPE = (cmbOrderType.SelectedItem as SYS_SUBDICSMODEL).FID; tBill.LH_SALESCHANNEL = (cmbSaleChannel.SelectedItem as SYS_SUBDICSMODEL).FID; tBill.LH_ORDERPRODLINE = (cboLH_ORDERPRODLINE.SelectedItem as SYS_SUBDICSMODEL).FID; tBill.LH_EXPECTEDARRIVEDDATE = dateDHRQ.DateTime; tBill.LH_PROMOTIONPOLICYID = (cmbPromotionPolicy.SelectedItem is LH_Policy)?(cmbPromotionPolicy.SelectedItem as LH_Policy).Id:null; tBill.LH_OUTBOUNDORDER = txtLH_OUTBOUNDORDER.Text; tBill.LH_ADVERTINGMONEYTYPE = (cmbDeductionMethod.SelectedItem as SYS_SUBDICSMODEL).FID; tBill.LH_BUTYPE = (cmbBusinessType.SelectedItem as SYS_SUBDICSMODEL).FID; #endregion #region 4、形成子表数据 foreach (var sub in list) { sub.FENTRYID = listSub.Count + 1; ICPOBILLENTRYMODEL sub0 = new ICPOBILLENTRYMODEL(); sub0.FID = sub.FID; sub0.FICPOBILLID = tBill.FID; sub0.FADVQTY = sub.FADVQTY; sub0.FBATCHNO = sub.FBATCHNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FENTRYID = sub.FENTRYID; sub0.FNEEDDATE = sub.FNEEDDATE; sub0.FPLANID = sub.FPLANID ?? "0"; sub0.FPRICE = sub.FPRICE; sub0.FREMARK = sub.FREMARK; sub0.FSRCQTY = sub.FSRCQTY; sub0.FSRCCOST = sub0.FPRICE * sub0.FSRCQTY; //后面添加的字段 sub0.FITEMID = sub.FSRCCODE; sub0.FSRCCODE = sub.FSRCCODE; sub0.FSRCNAME = sub.FSRCNAME; sub0.FSRCMODEL = sub.FSRCMODEL; sub0.Flevel = sub.Flevel; sub0.FstockNO = sub.FstockNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FcontractNO = sub.FcontractNO; sub0.Funit = sub.FORDERUNIT; sub0.FAUDQTY = sub.FAUDQTY; sub0.FPRICE = sub.FPRICE; sub0.Famount = sub.Famount; sub0.FREMARK = sub.FREMARK; sub0.FERR_MESSAGE = sub.FERR_MESSAGE; sub0.FNEEDDATE = DateTime.Now; sub0.FSRCQTY = sub.FSRCQTY; // sub0.LH_DCTPOLICYITEMID = sub.LH_DCTPOLICYITEMID; sub0.MINIMUMQUANTITY = sub.MINIMUMQUANTITY; sub0.CAPPINGQUANTITY = sub.CAPPINGQUANTITY; sub0.DISCOUNTRATE = sub.DISCOUNTRATE; sub0.LH_DCTPOLICYPRODNAME = sub.FPRODUCTNAME; sub0.LH_DCTPOLICYROWTYPE = sub.LH_DCTPOLICYROWTYPE; listSub.Add(sub0); } #endregion #region 5、开始保存 try { string sResult = _service.SaveICPOBILL(tBill, listSub.ToArray()); System.Windows.Forms.MessageBox.Show(sResult); if (this.SaveAfter != null) { SaveAfter(null, null); } this.Close(); } catch (Exception ee) { System.Windows.Forms.MessageBox.Show(ee.ToString()); } #endregion }
private void simpleButton3_Click(object sender, EventArgs e) { var list = gridControl采购订单列表.DataSource as List <V_ICPOBILLENTRYMODEL>; if (list.Count == 0) { System.Windows.Forms.MessageBox.Show("明细记录数不可为空!"); return; } string brand = ""; TB_BrandModel model = comBrand.SelectedItem as TB_BrandModel; if (model != null) { brand = model.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", model.FID); } else { System.Windows.Forms.MessageBox.Show("品牌不可为空!"); return; } if (txt厂家账户.Tag == null) { System.Windows.Forms.MessageBox.Show("厂家账户不可为空!"); return; } ICPOBILLMODEL tBill = new ICPOBILLMODEL(); tBill.FTRANSTYPE = "0"; tBill.FID = ""; tBill.FBRANDID = model.FID; tBill.FCLIENTID = txt厂家账户.Tag.ToStr(); tBill.FDATE = dateDatetime.DateTime; tBill.FBILLNO = _service.GetNewBillNo("PO"); tBill.FBILLERNAME = txtCreater.Text; tBill.FBILLER = txtCreater.Tag.ToStr(); tBill.FSTATE = 1; int iTemp = 1; List <ICPOBILLENTRYMODEL> listSub = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in list) { sub.FENTRYID = iTemp; ICPOBILLENTRYMODEL sub0 = new ICPOBILLENTRYMODEL(); sub0.FADVQTY = sub.FADVQTY; sub0.FBATCHNO = sub.FBATCHNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FENTRYID = sub.FENTRYID; sub0.FICPOBILLID = sub.FICPOBILLID; sub0.FID = sub.FID; sub0.FNEEDDATE = sub.FNEEDDATE; sub0.FPLANID = sub.FPLANID; sub0.FPRICE = sub.FPRICE; sub0.FREMARK = sub.FREMARK; sub0.FSRCCOST = sub.FSRCCOST; sub0.FSRCQTY = sub.FSRCQTY; sub0.FSTATE = sub.FSTATE; sub0.FSTATUS = sub.FSTATUS; listSub.Add(sub0); } string sResult = _service.SaveICPOBILL(tBill, listSub.ToArray()); System.Windows.Forms.MessageBox.Show(sResult); if (this.SaveAfter != null) { SaveAfter(null, null); } }
private void simpleButton3_Click(object sender, EventArgs e) { var list = gridControl采购订单明细.DataSource as List <V_ICPOBILLENTRYMODEL>; if (list.Count == 0) { System.Windows.Forms.MessageBox.Show("明细记录数不可为空!"); return; } string brand = ""; TB_BrandModel bmodel = comBrand.SelectedItem as TB_BrandModel; if (bmodel != null) { brand = bmodel.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", bmodel.FID); } else { System.Windows.Forms.MessageBox.Show("品牌不可为空!"); return; } if (txt厂家账户.Tag == null) { System.Windows.Forms.MessageBox.Show("厂家账户不可为空!"); return; } if (string.IsNullOrEmpty(model.FBILLNO)) { ICPOBILLMODEL tBill = new ICPOBILLMODEL(); tBill.FTRANSTYPE = "0"; tBill.FID = ""; tBill.FBRANDID = bmodel.FID; tBill.FCLIENTID = txt厂家账户.Tag.ToStr(); tBill.FDATE = dateDatetime.DateTime; tBill.FBILLNO = txtBillNO.Text; tBill.FBILLERNAME = txtCreater.Text; tBill.FBILLER = txtCreater.Tag.ToStr(); tBill.FSTATE = 1;//草稿 tBill.Fnote = txtRemarks.Text; tBill.FprojectNO = txtProjectNo.Text; if (searchDic105.Tag != null) { tBill.FPOtype = searchDic105.Tag.ToString(); } if (search价格策略.Tag != null) { tBill.Fpricepolicy = search价格策略.Tag.ToString(); } int iTemp = 1; List <ICPOBILLENTRYMODEL> listSub = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in list) { sub.FENTRYID = iTemp; if (sub.FPLANID == null) { string strFID = Guid.NewGuid().ToStr(); //插入一条icprentry记录 ICPRBILLENTRYMODEL tModel = new ICPRBILLENTRYMODEL(); tModel.FITEMID = sub.FITEMID; tModel.FUNITID = sub.FUNITID; tModel.FID = strFID; tModel.FPLANID = strFID; try { tModel.FASKAMOUNT = sub.Famount; } catch { } try { tModel.FASKQTY = sub.FAUDQTY; } catch { } tModel.FSTOREHOUSE = sub.FstockNO; tModel.FNEEDDATE = sub.FNEEDDATE == DateTime.MinValue ? DateTime.Now : sub.FNEEDDATE; tModel.FASKQTY = sub.FASKQTY; tModel.FORDERUNITQTY = (int)sub.FSRCQTY; string strResult = _service.Save_ICPREntry_List(tModel); sub.FPLANID = strResult; } if (listSub.Any(x => x.FITEMID == sub.FITEMID && sub.FCOLORNO == x.FCOLORNO && x.FPRICE == sub.FPRICE)) { ICPOBILLENTRYMODEL tSingle = listSub.First(x => x.FITEMID == sub.FITEMID && sub.FCOLORNO == x.FCOLORNO && x.FPRICE == sub.FPRICE); tSingle.FSRCQTY += sub.FSRCQTY; tSingle.FSRCCOST += sub.FSRCCOST; tSingle.Famount += sub.Famount; if (!string.IsNullOrEmpty(sub.ICPRBILLENTRYIDS)) { tSingle.ICPRBILLENTRYIDS += sub.ICPRBILLENTRYIDS + ";"; } tSingle.ICPRBILLENTRYIDS += sub.FPLANID + ";"; } else { ICPOBILLENTRYMODEL sub0 = new ICPOBILLENTRYMODEL(); sub0.FADVQTY = 1; sub0.FBATCHNO = ""; sub0.FCOLORNO = ""; sub0.FENTRYID = sub.FENTRYID; sub0.FICPOBILLID = sub.FICPOBILLID; sub0.FID = sub.FID; sub0.FNEEDDATE = sub.FNEEDDATE == DateTime.MinValue ? DateTime.Now : sub.FNEEDDATE; sub0.FPLANID = sub.FPLANID; if (sub0.FPLANID == null) { sub0.FPLANID = "0"; } sub0.FPRICE = sub.FPRICE; sub0.FREMARK = sub.FREMARK; sub0.FSRCCOST = sub.FSRCCOST; sub0.FSRCQTY = sub.FSRCQTY; sub0.FSTATE = sub.FSTATE; sub0.FSTATUS = sub.FSTATUS; //后面添加的字段 sub0.FITEMID = sub.FITEMID; sub0.FSRCCODE = sub.FSRCCODE; sub0.FSRCNAME = sub.FSRCNAME; sub0.FSRCMODEL = sub.FSRCMODEL; sub0.Flevel = sub.Flevel; sub0.FstockNO = sub.FstockNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FcontractNO = sub.FcontractNO; sub0.Funit = sub.Funit; sub0.FAUDQTY = sub.FAUDQTY; sub0.FPRICE = sub.FPRICE; sub0.Famount = sub.Famount; sub0.FREMARK = sub.FREMARK; sub0.FERR_MESSAGE = sub.FERR_MESSAGE; sub0.FSRCQTY = sub.FSRCQTY; if (!string.IsNullOrEmpty(sub.ICPRBILLENTRYIDS)) { sub0.ICPRBILLENTRYIDS += sub.ICPRBILLENTRYIDS + ";"; } sub0.ICPRBILLENTRYIDS += sub.FPLANID + ";"; listSub.Add(sub0); } } try { //string sResult = ICPOBILLBLL.Instance.SaveClient(tBill, listSub); string sResult = _service.SaveICPOBILL(tBill, listSub.ToArray()); //string sResult = ICPOBILLBLL.Instance.SaveClient(tBill, listSub.ToArray()); System.Windows.Forms.MessageBox.Show(sResult); if (this.SaveAfter != null) { try { SaveAfter(null, null); } catch { } } this.Close(); } catch (Exception ee) { System.Windows.Forms.MessageBox.Show(ee.ToString()); } } else { ICPOBILLMODEL tModel = _service.GetSingleOrder(model.FID); tModel.FBRANDID = bmodel.FID; tModel.FCLIENTID = txt厂家账户.Tag.ToStr(); tModel.FDATE = dateDatetime.DateTime; tModel.FBILLNO = txtBillNO.Text; tModel.FBILLERNAME = txtCreater.Text; tModel.FBILLER = txtCreater.Tag.ToStr(); tModel.FSTATE = 1;//草稿 tModel.Fnote = txtRemarks.Text; tModel.FprojectNO = txtProjectNo.Text; if (searchDic105.Tag != null) { tModel.FPOtype = searchDic105.Tag.ToString(); } if (search价格策略.Tag != null) { tModel.Fpricepolicy = search价格策略.Tag.ToString(); } //tModel.FSTATUS = 3; int iTemp = 1; bool bNeedDate_False = false; List <ICPOBILLENTRYMODEL> listSub = new List <ICPOBILLENTRYMODEL>(); foreach (var sub in list) { if (sub.FPLANID == null) { string strFID = Guid.NewGuid().ToStr(); //插入一条icprentry记录 ICPRBILLENTRYMODEL tRModel = new ICPRBILLENTRYMODEL(); tRModel.FITEMID = sub.FITEMID; tRModel.FUNITID = sub.FUNITID; tRModel.FID = strFID; tRModel.FPLANID = strFID; try { tRModel.FASKAMOUNT = sub.Famount; } catch { } try { tRModel.FASKQTY = sub.FAUDQTY; } catch { } tRModel.FSTOREHOUSE = sub.FstockNO; tRModel.FNEEDDATE = sub.FNEEDDATE; tRModel.FASKQTY = sub.FASKQTY; tRModel.FORDERUNITQTY = (int)sub.FSRCQTY; string strResult = _service.Save_ICPREntry_List(tRModel); sub.FPLANID = strResult; } if (listSub.Any(x => x.FITEMID == sub.FITEMID && sub.FCOLORNO == x.FCOLORNO && x.FPRICE == sub.FPRICE)) { ICPOBILLENTRYMODEL tSingle = listSub.First(x => x.FITEMID == sub.FITEMID && sub.FCOLORNO == x.FCOLORNO && x.FPRICE == sub.FPRICE); tSingle.FSRCQTY += sub.FSRCQTY; tSingle.FSRCCOST += sub.FSRCCOST; tSingle.Famount += sub.Famount; if (!string.IsNullOrEmpty(sub.ICPRBILLENTRYIDS)) { tSingle.ICPRBILLENTRYIDS += sub.ICPRBILLENTRYIDS + ";"; } tSingle.ICPRBILLENTRYIDS += sub.FPLANID + ";"; } else { sub.FENTRYID = listSub.Count + 1; ICPOBILLENTRYMODEL sub0 = new ICPOBILLENTRYMODEL(); sub0.FICPOBILLID = tModel.FID; sub0.FADVQTY = sub.FADVQTY; sub0.FBATCHNO = sub.FBATCHNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FENTRYID = sub.FENTRYID; // sub0.FICPOBILLID = sub.FICPOBILLID; sub0.FNEEDDATE = sub.FNEEDDATE; sub0.FPLANID = sub.FPLANID; if (sub0.FPLANID == null) { sub0.FPLANID = "0"; } sub0.FPRICE = sub.FPRICE; sub0.FREMARK = sub.FREMARK; sub0.FSRCQTY = sub.FSRCQTY; sub0.FSRCCOST = sub0.FPRICE * sub0.FSRCQTY; //后面添加的字段 sub0.FITEMID = sub.FITEMID; sub0.FSRCCODE = sub.FSRCCODE; sub0.FSRCNAME = sub.FSRCNAME; sub0.FSRCMODEL = sub.FSRCMODEL; sub0.Flevel = sub.Flevel; sub0.FstockNO = sub.FstockNO; sub0.FCOLORNO = sub.FCOLORNO; sub0.FcontractNO = sub.FcontractNO; sub0.Funit = sub.Funit; sub0.FAUDQTY = sub.FAUDQTY; sub0.FPRICE = sub.FPRICE; sub0.Famount = sub.Famount; sub0.FREMARK = sub.FREMARK; sub0.FERR_MESSAGE = sub.FERR_MESSAGE; sub0.FNEEDDATE = DateTime.Now; sub0.FSRCQTY = sub.FSRCQTY; sub0.ICPRBILLENTRYIDS = sub.ICPRBILLENTRYIDS; //sub0.FSTATUS = 3; listSub.Add(sub0); } } /* * if (bNeedDate_False == true) * { * System.Windows.Forms.MessageBox.Show("明细表中到货时间需重新核对!"); * return; * } */ try { //string sResult = ICPOBILLBLL.Instance.SaveClient(tModel, listSub.ToArray()); string sResult = _service.SaveICPOBILL(tModel, listSub.ToArray()); //string sResult= ICPOBILLBLL.Instance.SaveClient(tModel, listSub); System.Windows.Forms.MessageBox.Show(sResult); if (this.SaveAfter != null) { SaveAfter(null, null); } this.Close(); } catch (Exception ee) { System.Windows.Forms.MessageBox.Show(ee.ToString()); } } onCalcWeightTotal(); }
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("请选择你要确认的数据!"); } } }
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 backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { #region 蒙厂代码,不适用 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 { } 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; } #endregion }
public void Remote_GetICPOEntry(string strFID, string strEntryID, ref ICPOBILLMODEL billModel, ref ICPOBILLENTRYMODEL entryModel) { FactoryService.APIServiceClient api = new FactoryService.APIServiceClient(); FactoryService.ICPOBILLENTRYModel_MHLS tempModel = api.GetICPOEntry(strFID, strEntryID); billModel.FID = tempModel.FID; billModel.FBILLNO = tempModel.FBILLNO; billModel.FDesBillNo = tempModel.FDesBillNo; billModel.Fcompany = tempModel.Fcompany; billModel.FprojectNO = tempModel.FprojectNO; billModel.FSYNCSTATUS = tempModel.FSYNCSTATUS; billModel.FPOtype = tempModel.FPOtype; billModel.Fpricepolicy = tempModel.Fpricepolicy; entryModel.Fdesbillentry = tempModel.Fdesbillentry; entryModel.FERR_MESSAGE = tempModel.FERR_MESSAGE; }
/// <summary> /// 保存 /// </summary> /// <returns></returns> public int Add(ICPOBILLENTRYMODEL model, string ICPOBILLID) { return(ICPOBILLENTRYDAL.Instance.InsertWithFID(model, ICPOBILLID)); }