Exemple #1
0
        private void DoData(string data)
        {
            flagCancel = checkEdit2.Checked;//是否是入库取消模式

            //要委托的代码
            tbBucket.Text           = receivedata;
            tbBucket.SelectionStart = receivedata.Length;

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);

            if (dtThis.Rows.Count == 0)
            {
                PaCSGlobal.Speak("库存中不存在");
                lbStatus.Text         = "【" + data + "】:库存中不存在";
                panelStatus.BackColor = Color.Yellow;
                return;
            }
            curentMoveType = dtThis.Rows[0]["movetype"].ToString(); //获取当前MOVE_TYPE
            curentMoveCode = dtThis.Rows[0]["movecode"].ToString(); //获取当前MOVE_CODE

            //add by dyz@2014/10/5
            if (curentMoveType.Equals("999"))
            {
                GR(data);
                return;
            }

            if (flagCancel)
            {
                //入库取消 模式
                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("GRCJ"))
                {
                    PaCSGlobal.Speak("不能在此做取消操作");
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                CancelGR(data);
                tbBucket.Text = "";
            }
            else
            {
                //入库
                if (cmbLoc.SelectedIndex == -1)
                {
                    PaCSGlobal.Speak("请选择 入库地点");
                    lbStatus.Text         = "请选择 入库地点";
                    panelStatus.BackColor = Color.Yellow;
                    cmbLoc.Focus();
                    return;
                }

                final_vend_to = dtThis.Rows[0]["final_vend_to"].ToString();//获取当前final_vend_to
                if (!final_vend_to.Equals(PaCSGlobal.LoginUserInfo.Venderid))
                {
                    PaCSGlobal.Speak("不是出库到此的,不能进行 【入库】");
                    lbStatus.Text         = "【" + data + "】:不是出库到此的,不能进行 【入库】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                //判断状态
                if (!curentMoveType.Equals("351"))
                {
                    string tip = "";
                    if (int.Parse(curentMoveCode.Substring(4, 4)) > 301 && int.Parse(curentMoveCode.Substring(4, 4)) != 402)
                    {
                        PaCSGlobal.Speak("碳粉已经入库,不能再次 【入库】");
                        tip = "碳粉已经入库,不能再次 【入库】";
                    }

                    PaCSGlobal.Speak(tip);
                    lbStatus.Text         = "【" + data + "】:" + tip;
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                GR(data);
                tbBucket.Text = "";
            }
        }
        private void DoData(string data)
        {
            flagCancel = checkEdit2.Checked;//是否是取消模式

            //要委托的代码
            tbBucket.Text           = receivedata;
            tbBucket.SelectionStart = receivedata.Length;

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);

            if (dtThis.Rows.Count == 0)
            {
                PaCSGlobal.Speak("库存中不存在");
                lbStatus.Text = "【" + data + "】:库存中不存在";

                panelStatus.BackColor = Color.Yellow;
                return;
            }
            curentMoveType = dtThis.Rows[0]["movetype"].ToString();//获取当前MOVE_TYPE

            //add by dyz@2014/10/5
            if (curentMoveType.Equals("999"))
            {
                Dispose(data);
                return;
            }

            if (flagCancel)
            {
                //废弃取消 模式
                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("SCRAP"))
                {
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                CancelDispose(data);
            }
            else
            {
                //废弃
                final_vend_to = dtThis.Rows[0]["final_vend_to"].ToString();//获取当前final_vend_to
                if (!final_vend_to.Equals(PaCSGlobal.LoginUserInfo.Venderid))
                {
                    lbStatus.Text         = "【" + data + "】:不是出库到此的,不能进行 【废弃】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                //判断状态
                if (!curentMoveType.Equals("261"))
                {
                    lbStatus.Text         = "【" + data + "】:没有出库到Line,不能进行 【废弃】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                //已废弃
                if (curentMoveType.Equals("551"))
                {
                    lbStatus.Text         = "【" + data + "】:已经 【废弃】,不能再次废弃!";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                Dispose(data);
            }
        }
        private void DoData(string data)
        {
            if (cmbVendor.SelectedIndex == -1)
            {
                PaCSGlobal.Speak("请选择 生产厂家");
                lbStatus.Text         = "请选择 生产厂家";
                panelStatus.BackColor = Color.Yellow;
                cmbVendor.Focus();
                return;
            }
            else if (PaCSGlobal.LoginUserInfo.Fct_code.Equals("C660A"))
            {
                vendor  = (cmbVendor.SelectedItem as ComboxData).Value;//制造厂家
                vend_to = "DRI2";
                if (!vendor.Equals(data.Substring(11, 4)))
                {
                    PaCSGlobal.Speak("扫描碳粉生产厂家与选择厂家不符");
                    lbStatus.Text         = "扫描碳粉生产厂家【" + PaCSGlobal.GetVendorNameByCode(data.Substring(11, 4)) + "】与选择厂家【" + (cmbVendor.SelectedItem as ComboxData).Text + "】不符";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
            }
            else if (PaCSGlobal.LoginUserInfo.Fct_code.Equals("C6H0A"))
            {
                vendor = (cmbVendor.SelectedItem as ComboxData).Value;//制造厂家
                //vendor = "R100";
                vend_to = "RCAE";
                if (data.Substring(11, 4).Equals("R100"))
                {
                    PaCSGlobal.Speak("请扫描标签下方的条码");
                    lbStatus.Text         = "请扫描标签下方的条码";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
            }

            if (cmbItem.SelectedIndex == -1)
            {
                PaCSGlobal.Speak("请选择 材料编号");
                lbStatus.Text         = "请选择 材料编号";
                panelStatus.BackColor = Color.Yellow;
                cmbItem.Focus();
                return;
            }
            else
            {
                item = cmbItem.SelectedItem.ToString();
                if (!item.Equals(data.Substring(0, 11)))
                {
                    PaCSGlobal.Speak("扫描碳粉材料编号与选择编号不符");
                    lbStatus.Text         = "扫描碳粉材料编号与选择编号不符";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
            }

            flagCancel = checkEdit2.Checked;//是否是入库取消模式

            //要委托的代码
            tbBucket.Text           = receivedata;
            tbBucket.SelectionStart = receivedata.Length;

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);//获取扫描的记录信息(未入库000,已入库101,入库取消102)


            if (flagCancel)
            {
                //入库取消 模式
                if (dtThis.Rows.Count == 0)
                {
                    PaCSGlobal.Speak("库存中不存在");
                    lbStatus.Text         = "【" + data + "】:库存中不存在";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("GREJH"))
                {
                    PaCSGlobal.Speak("不能在此做取消操作");
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                CancelGR(data);
                tbBucket.Text = "";
            }
            else
            {
                //入库
                switch (radioGroup1.SelectedIndex)
                {
                case 0:    //首次入库
                    if (dtThis.Rows.Count > 0)
                    {
                        PaCSGlobal.Speak("已入库,不能再次入库");
                        lbStatus.Text         = "【" + data + "】:已入库,不能再次入库";
                        panelStatus.BackColor = Color.Yellow;
                        return;
                    }
                    GR(data);    //insert
                    tbBucket.Text = "";
                    break;

                case 1:    //返退入库
                    if (dtThis.Rows.Count == 0)
                    {
                        PaCSGlobal.Speak("库存中不存在");
                        lbStatus.Text         = "【" + data + "】:库存中不存在!";
                        panelStatus.BackColor = Color.Yellow;
                        return;
                    }
                    else
                    {
                        curentMoveType = dtThis.Rows[0]["movetype"].ToString();    //获取当前MOVE_TYPE
                        if (!curentMoveType.Equals("351"))
                        {
                            PaCSGlobal.Speak("不是在途状态,不能入库");
                            lbStatus.Text         = "【" + data + "】:不是在途状态,不能入库";
                            panelStatus.BackColor = Color.Yellow;
                            return;
                        }
                    }
                    GRAgain(data);    //update
                    tbBucket.Text = "";
                    break;
                }
            }
        }
        private void DoData(string data)
        {
            flagCancel = checkEdit2.Checked;        //是否是出库取消模式
            flagType   = radioGroup1.SelectedIndex; //出库类型

            //要委托的代码
            tbBucket.Text           = receivedata;
            tbBucket.SelectionStart = receivedata.Length;

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);

            if (dtThis.Rows.Count == 0)
            {
                PaCSGlobal.Speak("库存中不存在");
                lbStatus.Text         = "【" + data + "】:库存中不存在";
                panelStatus.BackColor = Color.Yellow;
                return;
            }
            curentMoveType = dtThis.Rows[0]["movetype"].ToString(); //获取当前MOVE_TYPE
            curentMoveCode = dtThis.Rows[0]["movecode"].ToString(); //获取当前MOVE_CODE

            if (flagCancel)
            {
                //出库取消 模式
                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("GIEJH"))
                {
                    PaCSGlobal.Speak("不能在此做取消操作");
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                CancelGI(data);
            }
            else
            {
                //出库
                final_vend_to = dtThis.Rows[0]["final_vend_to"].ToString();//获取当前final_vend_to
                if (!final_vend_to.Equals(PaCSGlobal.LoginUserInfo.Venderid))
                {
                    PaCSGlobal.Speak("不在此处,不能进行 【出库】");
                    lbStatus.Text         = "【" + data + "】:不在此处,不能进行 【出库】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                switch (flagType)
                {
                case 0:    //正常出库
                    if (cmbDestVendor.SelectedIndex == -1)
                    {
                        PaCSGlobal.Speak("请选择 目的厂家");
                        lbStatus.Text         = "请选择 目的厂家";
                        panelStatus.BackColor = Color.Yellow;
                        cmbDestVendor.Focus();
                        return;
                    }
                    else
                    {
                        vendorDest = (cmbDestVendor.SelectedItem as ComboxData).Value;    //目的厂家
                    }

                    //判断状态
                    if (!curentMoveType.Equals("101"))
                    {
                        string tip = "";
                        if (int.Parse(curentMoveCode.Substring(4, 4)) >= 201)
                        {
                            PaCSGlobal.Speak("碳粉已经出库,不能再次 【出库】");
                            tip = "碳粉已经出库,不能再次 【出库】";
                        }

                        PaCSGlobal.Speak(tip);
                        lbStatus.Text         = "【" + data + "】:" + tip;
                        panelStatus.BackColor = Color.Yellow;
                        return;
                    }
                    GI(data);
                    break;

                case 1:    //返退出库
                    GIBack(data);
                    break;

                case 2:    //出库即报废
                    if (String.IsNullOrEmpty(tbERP.Text.Trim()))
                    {
                        PaCSGlobal.Speak("请填写 【ERP秉义号】");
                        lbStatus.Text         = "请填写 【ERP秉义号】";
                        panelStatus.BackColor = Color.Yellow;
                        tbERP.Focus();
                        return;
                    }
                    GIScrap(data);
                    break;
                }
            }
        }
        private void DoData(string data)
        {
            string loc = "";

            flagCancel = checkEdit2.Checked;//是否是出库取消模式

            //要委托的代码
            tbBucket.Text           = receivedata;
            tbBucket.SelectionStart = receivedata.Length;

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);

            if (dtThis.Rows.Count == 0)
            {
                PaCSGlobal.Speak("库存中不存在");
                lbStatus.Text         = "【" + data + "】:库存中不存在";
                panelStatus.BackColor = Color.Yellow;
                return;
            }
            curentMoveType = dtThis.Rows[0]["movetype"].ToString(); //获取当前MOVE_TYPE
            curentMoveCode = dtThis.Rows[0]["movecode"].ToString(); //获取当前MOVE_CODE

            //add by dyz@2014/10/5
            GIType       = cmbType.SelectedIndex;       //0:buffer -- 1:其他厂家
            destMoveType = GIType == 0 ? "311" : "351"; //目的移动类型
            if (curentMoveType.Equals("999"))
            {
                GI(data);
                return;
            }

            if (flagCancel)
            {
                //出库取消 模式
                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("GICJ"))
                {
                    PaCSGlobal.Speak("不能在此做取消操作");
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                CancelGI(data);
                tbBucket.Text = "";
            }
            else
            {
                if (cmbDest.SelectedIndex == -1 && cmbType.SelectedIndex != 2)
                {
                    PaCSGlobal.Speak("请选择 出库目的地");
                    lbStatus.Text         = "请选择 出库目的地";
                    panelStatus.BackColor = Color.Yellow;
                    cmbDest.Focus();
                    return;
                }
                else
                {
                    destCode = (cmbDest.SelectedItem as ComboxData).Value;//目的地
                }

                final_stock_to = dtThis.Rows[0]["final_stock_to"].ToString();//获取当前final_vend_to
                if (cmbLoc.SelectedIndex > -1)
                {
                    loc = (cmbLoc.SelectedItem as ComboxData).Value;
                    if (!loc.Equals(final_stock_to))
                    {
                        PaCSGlobal.Speak("所在库存位置与选择库存位置不符");
                        lbStatus.Text         = "所在库存位置与选择库存位置不符";
                        panelStatus.BackColor = Color.Yellow;
                        return;
                    }
                }

                //出库
                final_vend_to = dtThis.Rows[0]["final_vend_to"].ToString();//获取当前final_vend_to
                if (!final_vend_to.Equals(PaCSGlobal.LoginUserInfo.Venderid))
                {
                    PaCSGlobal.Speak("不在此处,不能进行 【出库】");
                    lbStatus.Text         = "【" + data + "】:不在此处,不能进行 【出库】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                //判断状态
                if (!curentMoveType.Equals("352") && !curentMoveType.Equals("311"))
                {
                    string tip = "";
                    if (int.Parse(curentMoveCode.Substring(4, 4)) < 301)
                    {
                        PaCSGlobal.Speak("碳粉尚未入库,不能进行 【出库】");
                        tip = "碳粉尚未入库,不能进行 【出库】";
                    }
                    else if (int.Parse(curentMoveCode.Substring(4, 4)) > 302)////
                    {
                        PaCSGlobal.Speak("碳粉已经出库,不能再次 【出库】");
                        tip = "碳粉已经出库,不能再次 【出库】";
                    }

                    PaCSGlobal.Speak(tip);
                    lbStatus.Text         = "【" + data + "】:" + tip;
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                GIType = cmbType.SelectedIndex;

                switch (GIType)
                {
                case 0:
                    destMoveType = "311";    //buffer
                    break;

                case 1:
                    destMoveType = "351";    //其他厂家
                    break;
                }

                //  destMoveType = GIType == 0 ? "311" : "351";//目的移动类型

                GI(data);
                tbBucket.Text = "";
            }
        }
        private void DoData(string data)
        {
            flagCancel = checkEdit2.Checked;//是否是出库取消模式

            DataTable dtThis = TonerGlobal.ScanRecordStatus(data);

            if (dtThis.Rows.Count == 0)
            {
                PaCSGlobal.Speak("库存中不存在");
                lbStatus.Text         = "【" + data + "】:库存中不存在";
                panelStatus.BackColor = Color.Yellow;
                return;
            }
            curentMoveType = dtThis.Rows[0]["movetype"].ToString();//获取当前MOVE_TYPE

            //add by dyz@2014/10/5
            if (curentMoveType.Equals("999"))
            {
                GI(data);
                tbBucket.Text = "";
                return;
            }

            if (flagCancel)
            {
                //出库取消 模式
                currentDocno     = dtThis.Rows[0]["currentDocno"].ToString();     //获取当前finaldocno
                lastdocno        = dtThis.Rows[0]["lastdocno"].ToString();        //获取当前lastdocno
                operation_window = dtThis.Rows[0]["operation_window"].ToString(); //获取当前operation_window

                if (!operation_window.Equals("LINE"))
                {
                    PaCSGlobal.Speak("不能在此做取消操作");
                    lbStatus.Text         = "【" + data + "】:不能在此做取消操作";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                tbBucket.Text           = receivedata;
                tbBucket.SelectionStart = receivedata.Length;
                CancelGI(data);
                tbBucket.Text = "";
            }
            else
            {
                //校验楼层
                finalBuffer = dtThis.Rows[0]["final_buffer_to"].ToString();//获取当前MOVE_TYPE

                if (cmbBuffer.SelectedIndex == -1)
                {
                    PaCSGlobal.Speak("请选择 来自楼层");
                    lbStatus.Text         = "请选择 来自楼层";
                    panelStatus.BackColor = Color.Yellow;
                    cmbBuffer.Focus();
                    return;
                }
                else if (!(cmbBuffer.SelectedItem as ComboxData).Value.Equals(finalBuffer))
                {
                    PaCSGlobal.Speak("所在楼层与选择楼层不符");
                    lbStatus.Text         = "【" + data + "】:所在楼层与选择楼层不符";
                    panelStatus.BackColor = Color.Yellow;
                    cmbBuffer.Focus();
                    return;
                }

                if (cmbLine.SelectedIndex == -1)
                {
                    PaCSGlobal.Speak("请选择 生产线");
                    lbStatus.Text         = "请选择 生产线";
                    panelStatus.BackColor = Color.Yellow;
                    cmbLine.Focus();
                    return;
                }
                else
                {
                    lineCode = (cmbLine.SelectedItem as ComboxData).Value;//目的地
                }

                //出库
                final_vend_to = dtThis.Rows[0]["final_vend_to"].ToString();//获取当前final_vend_to
                if (!final_vend_to.Equals(PaCSGlobal.LoginUserInfo.Venderid))
                {
                    PaCSGlobal.Speak("不在此处,不能进行 【出库】");
                    lbStatus.Text         = "【" + data + "】:不在此处,不能进行 【出库】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }

                //判断状态
                if (!curentMoveType.Equals("311"))
                {
                    PaCSGlobal.Speak("该碳粉不是缓冲区状态,不能进行 【出库】");
                    lbStatus.Text         = "【" + data + "】:不是Buffer状态,不能进行 【出库到Line】";
                    panelStatus.BackColor = Color.Yellow;
                    return;
                }
                tbBucket.Text           = receivedata;
                tbBucket.SelectionStart = receivedata.Length;
                GI(data);
                tbBucket.Text = "";
            }
        }