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().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 args = new Dictionary(); args.Add("start_time", "2019-4-1"); args.Add("end_time", "2019-4-2"); //InventoryProxy ip = (InventoryProxy)i.Load(args); InventoryProxy bp = i.Load(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 args = new Dictionary(); 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 args = new Dictionary(); 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); //} } /// /// u8到中间 /// /// /// /// 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; /// /// U8到中间 /// /// 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("请输入正确的格式"); } } /// /// 中间到旺店通 /// /// 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 args = new Dictionary(); 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 args = new Dictionary(); //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 args = new Dictionary(); 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 args = new Dictionary(); //foreach (DataRow dr in dt.Rows) //{ // args["warehouse_no"] = whcode; // args["spec_no"] = dr["cinvcode"].ToString(); // up.UpLoad(args); //} StockUpLoad up = new StockUpLoad(); Dictionary args = new Dictionary(); args["warehouse_no"] = whcode; args["start_time"] = "2019-8-1"; args["end_time"] = "2019-8-20"; up.UpLoad(args); } } }