123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Quartz;
- using Quartz.Impl;
- using TimeSchedule;
- using WdtUtils;
- using Newtonsoft.Json;
- using WdtUtils.Proxy;
- using WdtUtils.Load;
- using Newtonsoft.Json.Linq;
- using TempDbToUfida.OpenApi;
- using TempDbToUfida;
- using WangToTempDb;
- using System.Diagnostics;
- using cuidian.Common;
- using System.Collections;
- using System.Collections.Specialized;
- using cuidian.OpenApi.Api;
- using cuidian.OpenApi.Utils;
- using Newtonsoft.Json.Serialization;
- using cuidian.OpenApi.Model;
- using UfidaToTempDb;
- using System.Threading;
- using WdtUtils.UpLoad;
- using TempDbToWang;
- using cuidian.Sql;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- __init();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
- IScheduler scheduler = schedulerFactory.GetScheduler();
- scheduler.Start();
- }
- private void aa()
- {
- ISchedulerFactory sf = new StdSchedulerFactory();
- IScheduler scheduler = sf.GetScheduler(); //创建调度实例
- //创建任务实例
- IJobDetail job = JobBuilder.Create<TimeSchedule.testjob1>().WithIdentity(new JobKey("job1")).Build();
- //创建触发器实例
- ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule("0/5 * * * * ? ").Build();
- scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
- scheduler.Start(); //启动监控
- }
- private void button2_Click(object sender, EventArgs e)
- {
- //aa();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- InventoryLoad i = new InventoryLoad();
- Dictionary<string, string> args = new Dictionary<string, string>();
- args.Add("start_time", "2019-4-1");
- args.Add("end_time", "2019-4-2");
- //InventoryProxy ip = (InventoryProxy)i.Load(args);
- InventoryProxy bp = i.Load<InventoryProxy>(args);
- int k;
- k = 0;
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- VendorApi api = new VendorApi();
- cuidian.OpenApi.Model.Vendor v = new cuidian.OpenApi.Model.Vendor();
- v.code = "004";
- v.sort_code = "01";
- v.abbrname = "004";
- v.name = "004";
- VendorRoot vr = new VendorRoot();
- vr.vendor = v;
- var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
- string s = JsonConvert.SerializeObject(vr, Formatting.Indented, jsonSetting);
- //string s = Newtonsoft.Json.JsonConvert.SerializeObject(v);
- //s = JsonConvert.SerializeObject(v);
- //s = "{\"vendor\":" + s + "}";
- //s = "{\"vendor\":{\"code\":\"0971\",\"name\":\"0971名称\",\"sort_code\":\"01\"}}";
- BusinessObject bo = api.Add(s);
- string a1 = bo.ErrCode;
- string a2 = bo.ErrMsg;
- int j;
- j = 10;
- }
- private void button2_Click_1(object sender, EventArgs e)
- {
- }
- private void button4_Click(object sender, EventArgs e)
- {
- }
- private void __init()
- {
- comboBox1.Items.Add("供应商");
- comboBox1.Items.Add("仓库");
- comboBox1.Items.Add("存货");
- comboBox1.Items.Add("其他入库");
- comboBox1.Items.Add("其他出库");
- comboBox1.Items.Add("采购订单");
- comboBox1.Items.Add("采购入库");
- comboBox1.Items.Add("采购退货");
- comboBox1.Items.Add("销售订单");
- comboBox1.Items.Add("销售出库");
- }
- private void button5_Click(object sender, EventArgs e)
- {
- if (comboBox1.SelectedItem == null)
- {
- MessageBox.Show("请选择数据类型");
- return;
- }
- string type = comboBox1.SelectedItem.ToString();
- Dictionary<string, string> args = new Dictionary<string, string>();
- IUpLoad upload = null;
- IUpLoad uploadTwo = null;
- switch (type)
- {
- case "供应商":
- upload = new VendorUpLoad();
- break;
- case "仓库":
- upload = new WarehouseUpLoad();
- break;
- case "存货":
- upload = new InventoryUpLoad();
- args.Add("start_time", "2020-08-13 13:34:55.000");
- args.Add("end_time", "2020-08-13 13:34:55.000");
- break;
- case "其他入库":
- upload = new StockinUpLoad();
- args.Add("status", "80");
- args.Add("order_type", "2");
- args.Add("start_time", "2019-10-1 00:00:00");
- args.Add("end_time", "2019-10-30 00:00:00");
- break;
- case "其他出库":
- upload = new StockoutUpLoad();
- args.Add("status", "110");
- args.Add("order_type", "2");
- args.Add("start_time", "2019-10-1 00:00:00");
- args.Add("end_time", "2019-10-30 00:00:00");
- break;
- case "采购订单":
- upload = new PO_PomainUpLoad();
- args.Add("purchase_no", "CG202006220036");
- break;
- case "采购入库":
- upload = new InvoiceItemaUpLoad();
- args.Add("start_time", "2019-10-1 00:00:00");
- args.Add("end_time", "2019-10-30 00:00:00.000");
- args.Add("status", "60");
- break;
- case "采购退货":
- upload = new PurchaseUpLoad();
- args.Add("start_time", "2019-10-17 20:51:28");
- args.Add("end_time", "2019-10-17 21:20:00");
- break;
- case "销售订单":
- upload = new TradeUpLoad();
- args.Add("start_time", "2019-10-17 20:51:28");
- args.Add("end_time", "2019-10-17 21:20:00");
- break;
- case "销售出库":
- upload = new DispatchListSendUpLoad();
- args.Add("start_time", "2019-11-30 00:00:00");
- args.Add("end_time", "2019-12-17 22:50:00");
- break;
- default:
- break;
- }
- try
- {
- upload.UpLoad(args);
- MessageBox.Show("ok");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void button6_Click(object sender, EventArgs e)
- {
- if (comboBox1.SelectedItem == null)
- {
- MessageBox.Show("请选择数据类型");
- return;
- }
- string type = comboBox1.SelectedItem.ToString();
- Dictionary<string, string> args = new Dictionary<string, string>();
- IDownLoad download = null;
- switch (type)
- {
- case "供应商":
- download = new DownLoadVendor();
- break;
- case "仓库":
- download = new DownLoadWarehouse();
- break;
- case "存货":
- download = new DownLoadInventory();
- break;
- case "其他入库":
- download = new DownLoadOtherin();
- break;
- case "其他出库":
- download = new DownLoadOtherout();
- break;
- case "采购订单":
- download = new DownLoadPurchaseorder();
- break;
- case "采购入库":
- download = new DownLoadPurchasein();
- break;
- case "采购退货":
- download = new DownLoadPurchasereturn();
- break;
- //case "销售订单":
- // download = new DownLoadSaleorder();
- // //MessageBox.Show("暂不可销售订单导入U8");
- // break;
- case "销售出库":
- download = new DownLoadReturnorder();
- //download = new DownLoadSellReturn();//退
- break;
- default:
- break;
- }
- //try
- //{
- download.DownLoad();
- MessageBox.Show("ok");
- //}
- //catch (Exception ex)
- //{
- // MessageBox.Show(ex.Message);
- //}
- }
- /// <summary>
- /// u8到中间
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- ///
- private void button8_Click(object sender, EventArgs e)
- {
- //把TR委托给Form2
- Form2 f2 = new Form2(SetTR);
- f2.Show();
- }
- private static BaseTrans _TR;
- private static TempDbToWang.BaseUpload _UR;
- /// <summary>
- /// U8到中间
- /// </summary>
- /// <param name="newTR"></param>
- private void SetTR(BaseTrans newTR)
- {
- try
- {
- _TR = newTR;
- Hashtable args = new Hashtable();
- args["Start"] = "2019-10-1 00:00:00";
- args["End"] = "2019-10-17 14:00:00";
- _TR.TransData(args);
- MessageBox.Show("成功");
- }
- catch
- {
- MessageBox.Show("请输入正确的格式");
- }
- }
- /// <summary>
- /// 中间到旺店通
- /// </summary>
- /// <param name="newTR"></param>
- private void SetUR(TempDbToWang.BaseUpload newUR)
- {
- try
- {
- _UR = newUR;
- Hashtable args = new Hashtable();
- //args["start_time"] = "2019-10-1 00:00:00";
- //args["end_time"] = DateTime.Now.AddMinutes(-10).ToString("yyyy-MM-dd HH:mm:ss");
- _UR.UploadToWang(args);
- #region 中间到旺店通测试专用
- //if (_UR is UploadRdrecord08)
- //{
- // UploadRdrecord08 UR08 = (UploadRdrecord08)_UR;
- // foreach (var item in UR08._results)
- // {
- // MessageBox.Show(item.Message);
- // }
- //}
- //else if (_UR is UploadRdrecord09)
- //{
- // UploadRdrecord09 UR09 = (UploadRdrecord09)_UR;
- // foreach (var item in UR09._results)
- // {
- // MessageBox.Show(item.Message);
- // }
- //}
- #endregion
- MessageBox.Show("成功");
- }
- catch
- {
- MessageBox.Show("失败");
- }
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- //其他入库单=>到中间=>旺店通
- private void button7_Click(object sender, EventArgs e)
- {
- Form3 f3 = new Form3(SetUR);
- f3.Show();
- }
- private void button9_Click(object sender, EventArgs e)
- {
- InventoryUpLoad upload = new InventoryUpLoad();
- DateTime dt1, dt2, dt3;
- dt1 = new DateTime(2017, 5, 1);
- dt2 = dt1.AddDays(30);
- dt3 = DateTime.Now;
- bool flag = true;
- try
- {
- while (dt2 <= dt3 && flag)
- {
- Dictionary<string, string> args = new Dictionary<string, string>();
- args["start_time"] = dt1.ToString("yyyy-MM-dd HH:mm:ss");
- args["end_time"] = dt2.ToString("yyyy-MM-dd HH:mm:ss");
- upload.UpLoad(args);
- dt1 = dt2.AddSeconds(1);
- dt2 = dt1.AddDays(30);
- if (dt2 > dt3)
- {
- dt2 = dt3;
- flag = false;
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- MessageBox.Show("ok");
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button10_Click(object sender, EventArgs e)
- {
- //string sql = "select cwhcode from warehouse where cwhcode in('WUX208','ZHQ202')";
- //string sql = "select cwhcode from warehouse ORDER by cwhcode";
- //DataTable dt = DbUtils.Fill(sql, ConnectionUtils.Instance.GetConnection());
- //foreach (DataRow dr in dt.Rows)
- //{
- // __GetStock(dr["cwhcode"].ToString());
- //}
- //StockUpLoad up = new StockUpLoad();
- //Dictionary<string, string> args = new Dictionary<string, string>();
- //args["warehouse_no"] = "2";
- ////args["spec_no"] = "01010010";
- //args["start_time"] = "2019-8-1";
- //args["end_time"] = "2019-8-20";
- //up.UpLoad(args);
- string sql = "select cinvcode from inventory";
- DataTable dt = DbUtils.Fill(sql, ConnectionUtils.Instance.GetConnection());
- StockUpLoad up = new StockUpLoad();
- Dictionary<string, string> args = new Dictionary<string, string>();
- foreach (DataRow dr in dt.Rows)
- {
- args["spec_no"] = dr["cinvcode"].ToString();
- up.UpLoad(args);
- }
- MessageBox.Show("aa");
- }
- private void __GetStock(string whcode)
- {
- //string sql = "select cinvcode from inventory";
- //DataTable dt = DbUtils.Fill(sql, ConnectionUtils.Instance.GetConnection());
- //StockUpLoad up = new StockUpLoad();
- //Dictionary<string, string> args = new Dictionary<string, string>();
- //foreach (DataRow dr in dt.Rows)
- //{
- // args["warehouse_no"] = whcode;
- // args["spec_no"] = dr["cinvcode"].ToString();
- // up.UpLoad(args);
- //}
- StockUpLoad up = new StockUpLoad();
- Dictionary<string, string> args = new Dictionary<string, string>();
- args["warehouse_no"] = whcode;
- args["start_time"] = "2019-8-1";
- args["end_time"] = "2019-8-20";
- up.UpLoad(args);
- }
- }
- }
|