private void outStockButton_Click(object sender, EventArgs e) { //打印标签 if (OnlineLogic()) { //向后台传入扫描商品信息 for (var i = 0; i < productsDataGrid.RowCount; i++) { ProductInfo product = new ProductInfo(); product.product_code = productsDataGrid.Rows[i].Cells[0].Value.ToString(); product.scanned_no = productsDataGrid.Rows[i].Cells[7].Value.ToString(); product.product_amount = productsDataGrid.Rows[i].Cells[6].Value.ToString(); productsInfo_list.Add(product); } //出库操作 Boolean flag = WhApi.StockOut(order_no, Newtonsoft.Json.JsonConvert.SerializeObject(productsInfo_list), Newtonsoft.Json.JsonConvert.SerializeObject(product_regno_list)); if (flag) { MessageBox.Show("出库成功。"); //初始化 InitControl(); } else { //初始化 InitControl(); } } ; }
private void numTextBox_SkinTxt_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } if (numTextBox.Text.Trim().IsNullOrEmpty()) { MessageBox.Show("请输入订单号"); return; } var product_order_no = numTextBox.Text.Trim(); productRegNoTextBox.Text = null; var orderInfo = WhApi.PostOrderInfos(product_order_no); if (orderInfo != null) { productsDataGrid.DataSource = orderInfo.products; productRegNoTextBox.Focus(); product_regno_list = new List <string>(); productsInfo_list = new List <ProductInfo>(); order_no = numTextBox.Text.Trim(); } else { productRegNoTextBox.Focus(); numTextBox.Focus(); } if (expressDataGrid.SelectedRows.Count != 0) { //快递公司默认不选中 expressDataGrid.SelectedRows[0].Selected = false; } }
private void printBtn_Click(object sender, EventArgs e) { String waybill_no = waybillNOTextBox.Text.Trim(); String product_reg_code = productRegCodeTextBox.Text.Trim(); String endRegNo = endRegNoTextBox.Text.Trim(); List <ProductRegInfo> productRegNo = WhApi.GetProductRegNo(waybill_no, product_reg_code, endRegNo); //打印商品登记号,每次打印两个 if (productRegNo != null && productRegNo.Count > 0) { for (int i = 0; i < productRegNo.Count; i += 2) { ProductRegInfo leftProductReg = productRegNo[i]; string rightNum = ""; string rightComCode = ""; string leftNum = leftProductReg.product_reg_code; string leftComCode = leftProductReg.company_product_code; if (i < productRegNo.Count - 1) { ProductRegInfo rightProductReg = productRegNo[i + 1]; rightComCode = productRegNo[i + 1].company_product_code; rightNum = productRegNo[i + 1].product_reg_code; } PrintLabel.ProductRegNoBarcodePrint(leftNum, rightNum, leftComCode, rightComCode); } PrintLabel.ProductRegNoBarcodePrint("", "", "", ""); } MessageBox.Show("条码打印完成。"); Init(); }
private void Login_Load(object sender, EventArgs e) { string accessToken = Properties.Settings.Default.ACCESS_TOKEN; if (!string.IsNullOrEmpty(accessToken)) { WhApi.logOut(); } }
private void OrderInfoControl_Load(object sender, EventArgs e) { //初始化快递公司信息 var expressRows = WhApi.PostJpExpressInfos(); if (!expressRows.IsNull()) { expressDataGrid.DataSource = expressRows; } }
private void printBtn_Click(object sender, EventArgs e) { String order_no = orderNoTextBox.Text.Trim(); String product_code = productCodeTextBox.Text.Trim(); List <String> productRegNo = WhApi.GetProductRegNo(order_no, product_code); //打印商品登记号,每次打印两个 if (productRegNo != null && productRegNo.Count > 0) { for (int i = 0; i < productRegNo.Count; i += 2) { string rightNum = ""; string leftNum = productRegNo[i]; if (i < productRegNo.Count - 1) { rightNum = productRegNo[i + 1]; } PrintLabel.BarcodePrint(leftNum, rightNum); } } }
private void closeLabel_Click(object sender, EventArgs e) { WhApi.logOut(); Application.Exit(); }
//在线打印 private Boolean OnlineLogic() { var product_order_no = numTextBox.Text.Trim(); string jpExpSecId = null; string expressCompany = null; string store = null; //获取订单详情 var orderInfo = WhApi.PostOrderInfos(product_order_no); var pacIndex = 0; //不能打印出库状态的订单 if (orderInfo.delivery_state.Equals("24")) { MessageBox.Show("打印出库失败。(订单状态错误)"); InitControl(); return(false); } if (orderInfo.IsNull()) { InitControl(); } else if (orderInfo.products.IsNull() || orderInfo.products.Count == 0) { MessageBox.Show("没查询到订单的商品信息。"); } else { //判断是否有日本号,如果有直接打印,如果没有先分配日本号再打印 if (orderInfo.jp_express_no.IsNullOrEmpty()) { //判断是否有默认快递公司 if (orderInfo.jp_express_section_id.IsNullOrEmpty() || orderInfo.products.Count > 1) { if (jpExpSecId.IsNullOrEmpty() && expressDataGrid.SelectedRows.Count == 0) { MessageBox.Show("请选择快递公司再进行操作。"); return(false); } else { if (expressDataGrid.SelectedRows.Count != 0) { jpExpSecId = expressDataGrid.SelectedRows[0].Cells[0].Value.ToString(); store = expressDataGrid.SelectedRows[0].Cells[3].Value.ToString(); expressCompany = expressDataGrid.SelectedRows[0].Cells[1].Value.ToString(); } if (WhApi.DistributionJpNo(product_order_no, jpExpSecId)) { orderInfo = WhApi.PostOrderInfos(product_order_no); } } } else { if (WhApi.DistributionJpNo(product_order_no, orderInfo.jp_express_section_id)) { orderInfo = WhApi.PostOrderInfos(product_order_no); expressCompany = orderInfo.jp_express_company; store = orderInfo.city_code; } } } else { store = orderInfo.city_code; expressCompany = orderInfo.jp_express_company; } for (int c = 0; c < orderInfo.products.Count; c++) { if (orderInfo.products[c].check_flag.Equals("N")) { MessageBox.Show("商品[" + orderInfo.products[c].product_code + "],未审查派送公司。操作失败!"); return(false); } } //添加额外信息 AddExtraInfo(orderInfo, store); switch (expressCompany) { case "SAGAWA": PrintLabel.OWHSagawaLablePrint(orderInfo, pacIndex); break; case "JP_EMS": PrintLabel.JapanEmsPrint(orderInfo, pacIndex); break; case "JP_EMS_SMALL": PrintLabel.JapanEmsSmallPrint(orderInfo, pacIndex); break; case "SAGAWA_HIKIYAKU": PrintLabel.SagawaHikiyakuPrint(orderInfo, pacIndex); break; case "YAMATO": PrintLabel.YamatoLablePrint(orderInfo, pacIndex); break; } } return(true); }