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) { LogError(ex); MsgHelper.ShowError("登陆异常!"); } }
private void onSearch() { string xq = "";// txt销区.Text; string brand = ""; int status = 0; string premiseid = ""; string billno = txt采购单号.Text; if (cbo品牌.SelectedItem != null) { TB_BrandModel model = cbo品牌.SelectedItem as TB_BrandModel; if (model != null) { brand = model.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", model.FID); } } if (cbo状态.SelectedItem != null) { CodeValueClass model = cbo状态.SelectedItem as CodeValueClass; if (model != null) { status = model.value.ToInt(); } } // if (txt经营场所.Tag != null) // { // premiseid = txt经营场所.Tag.ToString(); // } // gridControl采购订单明细.DataSource = null; }
private void btn确定_Click(object sender, EventArgs e) { IniHelper.WriteString(Global.IniUrl, "CONFIG", "URL", txtUrl.Text); Global.WcfUrl = txtUrl.Text; this.Close(); }
private void onSearch() { xq = txt销区.Text; brand = ""; status = 0; account = ""; expresscompany = ""; if (cbo品牌.SelectedItem != null) { TB_BrandModel model = cbo品牌.SelectedItem as TB_BrandModel; if (model != null) { brand = model.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", model.FID); } } if (cbo状态.SelectedItem != null) { CodeValueClass model = cbo状态.SelectedItem as CodeValueClass; if (model != null) { status = model.value.ToInt(); } } if (txt厂家账户.Tag != null) { account = txt厂家账户.Tag.ToString(); } if (txt承运公司.Tag != null) { expresscompany = txt承运公司.Tag.ToString(); } car = txt车辆.Text; startdate = formatDateTime(txt日期开始.DateTime); enddate = formatDateTime(txt日期结束.DateTime); gridControl发货计划明细.DataSource = null; optype = "0"; if (backgroundWorker2.IsBusy == false) { setButton(false); backgroundWorker2.RunWorkerAsync(); } }
private void onSearch() { string xq = txt销区.Text; string brand = ""; int status = 0; string premiseid = ""; string billno = txt请购单号.Text; if (cbo品牌.SelectedItem != null) { TB_BrandModel model = cbo品牌.SelectedItem as TB_BrandModel; if (model != null) { brand = model.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", model.FID); } } if (cbo状态.SelectedItem != null) { CodeValueClass model = cbo状态.SelectedItem as CodeValueClass; if (model != null) { status = model.value.ToInt(); } } if (txt经营场所.Tag != null) { premiseid = txt经营场所.Tag.ToString(); } gridControl请购计划明细.DataSource = null; var list = _service.GetPurchasePlanList( Global.LoginUser, xq == "全部" ? "" : xq, brand, status, premiseid, billno, formatDateTime(txt日期开始.DateTime), formatDateTime(txt日期结束.DateTime), !chkClose.Checked); gridControl请购计划列表.DataSource = list; lbl记录数.Text = string.Format("共查询得到记录{0}条", list.Count()); }
/// <summary> /// 保存校验 /// </summary> /// <returns></returns> bool SaveCheck() { bool TF = true; var list = gridControl采购订单明细.DataSource as IEnumerable <object>; if (list == null || list.Count() == 0) { System.Windows.Forms.MessageBox.Show("明细记录数不可为空!"); return(TF); } TB_BrandModel bmodel = comBrand.SelectedItem as TB_BrandModel; if (bmodel != null) { IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", bmodel.FID); } else { System.Windows.Forms.MessageBox.Show("品牌不可为空!"); return(TF); } if (txt厂家账户.Tag == null) { System.Windows.Forms.MessageBox.Show("厂家账户不可为空!"); return(TF); } if ((cmbOrderType.SelectedItem as SYS_SUBDICSMODEL) == null) { System.Windows.Forms.MessageBox.Show("订单类型不能为空!"); return(TF); } if ((cmbSaleChannel.SelectedItem as SYS_SUBDICSMODEL) == null) { System.Windows.Forms.MessageBox.Show("销售渠道不能为空!"); return(TF); } if ((cmbSaleChannel.SelectedItem as SYS_SUBDICSMODEL) == null) { System.Windows.Forms.MessageBox.Show("产品线不能为空!"); return(TF); } if (string.IsNullOrWhiteSpace(dateDHRQ.Text)) { System.Windows.Forms.MessageBox.Show("期望到货日期不能为空!"); return(TF); } //if (!(cmbPromotionPolicy.SelectedItem is LH_Policy)) //{ // System.Windows.Forms.MessageBox.Show("促销政策头ID不能为空!"); // return TF; //} if ((cmbDeductionMethod.SelectedItem as SYS_SUBDICSMODEL) == null) { System.Windows.Forms.MessageBox.Show("扣款方式不能为空!"); return(TF); } if ((cmbBusinessType.SelectedItem as SYS_SUBDICSMODEL) == null) { System.Windows.Forms.MessageBox.Show("业务类型不能为空!"); return(TF); } return(false); }
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 onSearch() { string xq = txt销区.Text; string brand = ""; int status = 0; string account = ""; string expresscompany = ""; if (cbo品牌.SelectedItem != null) { TB_BrandModel model = cbo品牌.SelectedItem as TB_BrandModel; if (model != null) { brand = model.FID; IniHelper.WriteString(Global.IniUrl, "CONFIG", "FBRANDID", model.FID); } } if (cbo状态.SelectedItem != null) { CodeValueClass model = cbo状态.SelectedItem as CodeValueClass; if (model != null) { status = model.value.ToInt(); } } if (txt厂家账户.Tag != null) { account = txt厂家账户.Tag.ToString(); } if (txt承运公司.Tag != null) { expresscompany = txt承运公司.Tag.ToString(); } string car = txt车辆.Text; string startdate = formatDateTime(txt日期开始.DateTime); string enddate = formatDateTime(txt日期结束.DateTime); gridControl发货计划明细.DataSource = null; _dataSrouce = _service.GetGroupList( 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); gridControl发货计划列表.DataSource = _dataSrouce; }
/// <summary> /// 判断是否需要更新程序 /// </summary> /// <returns></returns> private static bool Update() { VerModel verModel = null; string error = ""; bool isUpdate = false; if (GetVersion(out verModel, out error)) { if (verModel != null && verModel.VerCode > Global.VersionInterior) //是否内部版本号比当前的大 { if (verModel.IsMustUpdate) //是否是强制更新 { isUpdate = true; } else { if (MsgHelper.AskQuestion("有新的版本发布,是否下载更新?")) { isUpdate = true; } else { return(true); } } if (isUpdate) { //获取需要更新的文件,并且记录在Update.txt文件夹中 List <string> list = null; if (GetUpdateFiles(out list, out error)) { if (list == null || list.Count == 0) { MsgHelper.ShowError("获取更新文件为空!"); return(false); } string path = Application.ExecutablePath; char strSplit = '\\'; if (path.Contains("\\")) { strSplit = '\\'; } else if (path.Contains("/")) { strSplit = '/'; } string[] array = path.Split(strSplit); string name = array[array.Length - 1].Split('.')[0]; using (StreamWriter sw = File.CreateText(Global.UpdatePath)) { sw.WriteLine(name); foreach (string str in list) { sw.WriteLine(str); } } IniHelper.WriteString(Global.IniUrl, "CONFIG", "VerName", verModel.VerName); Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = Application.StartupPath + "\\AutoUpdate.exe"; p.Start(); Environment.Exit(0); return(false); } else { MsgHelper.ShowError("获取更新文件失败!/r/n" + error); } } } else { return(true); } } else { MsgHelper.ShowError(error); } return(false); }