private void initComboBox() { //初始化品牌列表 var list = _service.GetBrandList(Global.LoginUser); foreach (var item in list) { cbo品牌.Properties.Items.Add(item); string brandid = IniHelper.ReadString(Global.IniUrl, "CONFIG", "FBRANDID", ""); if (item.FID == brandid) { cbo品牌.SelectedItem = item; } comBrand.Properties.Items.Add(item); if (item.FID == brandid) { comBrand.SelectedItem = item; } } //初始化单据状态选择 cbo状态.Properties.Items.Add(new CodeValueClass("0", "全部")); cbo状态.Properties.Items.Add(new CodeValueClass("3", "审核通过")); cbo状态.Properties.Items.Add(new CodeValueClass("7", "采购确认")); cbo状态.Properties.Items.Add(new CodeValueClass("1", "草稿")); cbo状态.Properties.Items.Add(new CodeValueClass("2", "待审核")); cbo状态.Properties.Items.Add(new CodeValueClass("4", "审核不通过")); cbo状态.Properties.Items.Add(new CodeValueClass("6", "完成")); cbo状态.Properties.Items.Add(new CodeValueClass("5", "关闭")); }
private void initComboBox() { //初始化品牌列表 var list = _service.GetBrandList(Global.LoginUser); foreach (var item in list) { cbo品牌.Properties.Items.Add(item); string brandid = IniHelper.ReadString(Global.IniUrl, "CONFIG", "FBRANDID", ""); if (item.FID == brandid) { cbo品牌.SelectedItem = item; } } //初始化单据状态选择 var billTypes = Enum.GetValues(typeof(ICPOBILLStatus)); foreach (var billType in billTypes) { cbo状态.Properties.Items.Add(billType); } cbo状态.SelectedItem = null; }
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 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 btn确定_Click(object sender, EventArgs e) { IniHelper.WriteString(Global.IniUrl, "CONFIG", "URL", txtUrl.Text); Global.WcfUrl = txtUrl.Text; this.Close(); }
public FrmLogin() { InitializeComponent(); SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DropSHADOW); //API函数加载,实现窗体边框阴影效果 txtACC.Focus(); txtACC.Text = IniHelper.ReadString(Global.IniUrl, "CONFIG", "username", ""); txtPAS.Text = IniHelper.ReadString(Global.IniUrl, "CONFIG", "password", ""); lblVerName.Text = IniHelper.ReadString(Global.IniUrl, "CONFIG", "VerName", ""); }
static void Main() { Global.WcfUrl = IniHelper.ReadString(Global.IniUrl, "CONFIG", "URL", ""); Global.WebUrl = IniHelper.ReadString(Global.IniUrl, "CONFIG", "Web", ""); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmLogin()); }
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 initComboBox() { //初始化品牌列表 var list = _service.GetBrandList(Global.LoginUser); foreach (var item in list) { cbo品牌.Properties.Items.Add(item); string brandid = IniHelper.ReadString(Global.IniUrl, "CONFIG", "FBRANDID", ""); if (item.FID == brandid) { cbo品牌.SelectedItem = item; } } }
void setBrandCombox() { var list = _service.GetBrandList(Global.LoginUser); list = list.Where(p => p.FNAME.Contains("箭牌") || p.FNAME.Contains("法恩")).ToArray(); string brandid = IniHelper.ReadString(Global.IniUrl, "CONFIG", "FBRANDID", ""); comBrand.Properties.Items.AddRange(list); comBrand.SelectedIndex = 0; var selectBrand = list.SingleOrDefault(p => p.FID == brandid); if (selectBrand != null) { comBrand.SelectedItem = selectBrand; } }
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()); }
public frm库存查询(int status = 3) { InitializeComponent(); _service = new ApiService.APIServiceClient("BasicHttpBinding_IAPIService", Global.WcfUrl); //初始化品牌列表 var list = _service.GetBrandList(Global.LoginUser); foreach (var item in list) { cbo品牌.Properties.Items.Add(item); string brandid = IniHelper.ReadString(Global.IniUrl, "CONFIG", "FBRANDID", ""); if (item.FID == brandid) { cbo品牌.SelectedItem = item; } } loadDrop(); }
/// <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); } }
/// <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); }
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; }
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 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(); }
public FrmConfig() { InitializeComponent(); txtUrl.Text = IniHelper.ReadString(Global.IniUrl, "CONFIG", "URL", ""); }