using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DeiNiu.Wms.CE.Util; namespace DeiNiu.Wms.CE { public partial class BatchStockOutValidation : basicForm { // WmsOutPickRequestClient client { get; set; } public BatchStockOutValidation() { setTitle(); InitializeComponent(); // client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService")); // setValidCnt(); } string goods_id = ""; string state = "true"; string custom_id=""; int code = 0; double zero = 0; int checkBy2 = 0; bool isDoubleChk = false; private void clear() { labelHint.Text = name_lab.Text = spec_lab.Text = unit_lab.Text = PCompany_lab.Text = lacationid_lab.Text = batch_lab.Text = product_date_lab.Text = save_date_lab.Text = int_lab.Text = bigcount_lab.Text = ""; //button2.Text = ""; Stocknum_lab.Text = "0"; code = 0; tBss.Text = ""; state = "True"; goods_id = ""; //zero = 0; custor_name_lab.Text = ""; order_id_lab.Text = ""; } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if(e.KeyChar==13) { if(textBox1.Text.Trim()=="") { return; } try { code = Convert.ToInt32(textBox1.Text.Trim()); } catch { MessageBox.Show("输入错误"); textBox1.Focus(); return; } textBox1.Text = ""; DataTable dt = null; Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { dt = client.getPickDetail(code); } catch (Exception er) { Cursor.Current = System.Windows.Forms.Cursors.Default; MessageBox.Show("发生错误:" + er.Message); return; } Cursor.Current = System.Windows.Forms.Cursors.Default; if(dt.Rows.Count==0) { MessageBox.Show("已经提交!"); clear(); return; } order_id_lab.Text = dt.Rows[0]["pickOrderNo"].ToString(); setValidCnt(); name_lab.Text = dt.Rows[0]["goodsName"].ToString(); unit_lab.Text = dt.Rows[0]["unit"].ToString(); spec_lab.Text = dt.Rows[0]["spec"].ToString(); bigcount_lab.Text = dt.Rows[0]["bigcount"].ToString(); PCompany_lab.Text = dt.Rows[0]["manufacturer"].ToString(); Stocknum_lab.Text = dt.Rows[0]["count"].ToString(); bigcount_lab.Text = dt.Rows[0]["bigcount"].ToString(); batch_lab.Text = dt.Rows[0]["batch"].ToString(); lacationid_lab.Text = dt.Rows[0]["locationId"].ToString(); product_date_lab.Text = dt.Rows[0]["productDate"].ToString(); save_date_lab.Text =dt.Rows[0]["validdate"].ToString(); order_id_lab.Text =dt.Rows[0]["pickOrderNo"].ToString(); custor_name_lab.Text = dt.Rows[0]["customerName"].ToString(); // lbcolor.Text = dt.Rows[0]["颜色"].ToString(); // state = dt.Rows[0]["扫描药监码"].ToString(); goods_id=dt.Rows[0]["goodsid"].ToString(); //button2.Text="未复核数量:"+dt.Rows.Count+"条"; custom_id = dt.Rows[0]["customerid"].ToString(); isDoubleChk = dt.Rows[0]["isDouChk"].ToString()=="Y"; //zero =Convert.ToDouble( dt.Rows[0]["zero"].ToString()); double intnum = Convert.ToDouble(Convert.ToDouble(dt.Rows[0]["count"].ToString()) / Convert.ToDouble(dt.Rows[0]["bigcount"].ToString())); int_lab.Text = intnum.ToString(); enumPickState pkstate = (enumPickState) Convert.ToInt16(dt.Rows[0]["state"].ToString()); labelHint.Text = pkstate == enumPickState.已拣 ? "待复核" : pkstate.ToString(); button1.Enabled = pkstate == enumPickState.已拣; } } private void button1_Click(object sender, EventArgs e)//提交 { if (code <= 0) { return; } double sssl = 0; double checkcount = 0; if (isDoubleChk) { validLogin vl = new validLogin(); vl.setRole(WmsConstants.PERMISSION_VALID); vl.ShowDialog(); } if (isDoubleChk) { if (WmsConstants.SECOND_VALID_ER == LoginInfo.UserId || WmsConstants.SECOND_VALID_ER <= 0) { MessageBox.Show("非法的第二检验人,验收失败"); return; } } //try //{ checkcount = Convert.ToDouble(Stocknum_lab.Text); sssl = checkcount; // if (tBss.Text == "") // { // sssl = checkcount; // } // else // { // sssl = Convert.ToDouble(tBss.Text.Trim()); // } //} //catch //{ // sssl = checkcount; //} //if (checkcount == sssl) //{ // sssl = 0; //} //double sssl = 0; //try //{ // sssl = Convert.ToDouble(Stocknum_lab.Text.ToString()); //} //catch //{ //} bool b = false; Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { b = client.finishBatchValidateItem(order_id_lab.Text, code, LoginInfo.UserId, WmsConstants.SECOND_VALID_ER, LoginInfo.Token); } catch (Exception er) { Cursor.Current = System.Windows.Forms.Cursors.Default; MessageBox.Show("发生错误:" + er.Message); return; } Cursor.Current = System.Windows.Forms.Cursors.Default; if (b == true) { MessageBox.Show("提交成功!"); //if(state=="True" && checkBox1.Checked==true) //{ //OutCode.goodsid = goods_id; //OutCode.orderid = order_id_lab.Text; //OutCode.billcode=order_id_lab.Text; //OutCode.custorid =custom_id; //OutCode.locationid=lacationid_lab.Text.ToString(); //OutCode.custorname = custor_name_lab.Text; //OutCode.tag = 1; //new Code.OutCode().ShowDialog(); //Code.OutCode.clear(); //} setValidCnt(); clear(); textBox1.Focus(); } else { MessageBox.Show("提交失败!!!"); } } void setValidCnt() { int cnt = 0; Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { cnt = client.batchPickCount4Valid(order_id_lab.Text); } catch (Exception er) { Cursor.Current = System.Windows.Forms.Cursors.Default; MessageBox.Show("发生错误:" + er.Message); return; } Cursor.Current = System.Windows.Forms.Cursors.Default; button2.Text = "未复核数量:" + cnt + "条"; if (cnt == 0) { order_id_lab.Text = ""; custor_name_lab.Text = ""; lbcolor.Text = ""; } } private void button2_Click(object sender, EventArgs e) { //if(order_id_lab.Text=="") //{ // return; //} //BatchStockOut4ValidList.goodsid = goods_id; Cursor.Current = Cursors.WaitCursor; BatchStockOut4ValidList.order_id = order_id_lab.Text; BatchStockOut4ValidList.custor_name = custor_name_lab.Text; BatchStockOut4ValidList a = new BatchStockOut4ValidList(); a.ShowDialog(); } private void textBox1_TextChanged(object sender, EventArgs e) { } } }