示例#1
0
 private void bucketMaintenanceBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(newBucketNoBox.Text))
         {
             msgBox.Text = string.Empty;
             BucketMaintenance frm = new BucketMaintenance(newBucketNoBox.Text);
             if (frm.ShowDialog(this) == DialogResult.OK)
             {
                 FMBUCKETEntity bucket = DbAccess.GetBucket(newBucketNoBox.Text);
                 newBucketWeightBox.Text = bucket.PACKING_WEIGHT.ToString();
             }
         }
         else
         {
             msgBox.Text = "请输入BucketNo";
         }
     }
     catch (Exception ex)
     {
         msgBox.Text = ex.Message;
     }
 }
示例#2
0
        private bool DoTouCyaKu(FNTOUCYAKUEntity touCyaKu)
        {
            bucketNoBox.Text = touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR" ? string.Empty : touCyaKu.BUCKET_NO;

            if (touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR")
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                setStatusBox("条码未读取");
                setUIOnExport();
                isOperating = true;
                return(false);
            }

            FNHANSOEntity hanSo = DbAccess.GetHanSo(touCyaKu.MCKEY);

            if (hanSo == null)
            {
                setStatusBox("排出");
                touCyaKu.SYORIFLG = "1";
                touCyaKu.Save();
                setUIOnExport();
                isOperating = true;
                return(false);
            }

            if (touCyaKu.HEIGHT_FLAG == "3")    //货形高低异常
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error);
                setStatusBox("Bucket高度异常");
                setUIOnExport();
                isOperating = true;
                return(false);
            }

            FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo);

            if (station == null)
            {
                return(false);
            }

            if (station.NYUSYUMODE == Nyusyumode.Empty_Bucket)
            {
                setStatusBox("空箱登录模式");
                isOperating = true;
                return(true);
            }

            if (station.NYUSYUMODE == Nyusyumode.Normal)    //入库模式
            {
                bucket = DbAccess.GetBucket(touCyaKu.BUCKET_NO);
                if (bucket == null)
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                    setStatusBox("空箱未登录");
                    setUIOnExport();
                    isOperating = true;
                    return(false);
                }

                bucketWeightBox.Text = bucket.PACKING_WEIGHT.ToString();
                if (bucket.HEIGHT_FLAG != touCyaKu.HEIGHT_FLAG)
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error);
                    setStatusBox("Bucket高度异常");
                    setUIOnExport();
                    isOperating = true;
                    return(false);
                }

                if (DbAccess.IsBucketInLocation(bucket.BUCKET_NO))
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                    setStatusBox("Bucket重复");
                    setUIOnExport();
                    isOperating = true;
                    return(false);
                }

                zaiKo = DbAccess.GetZaiKoByBucketNo(bucket.BUCKET_NO);
                if (zaiKo == null)
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                    setStatusBox("Bucket未设定");
                    setUIOnExport();
                    isOperating = true;
                    return(false);
                }

                msgBox.Clear();
                setStatusBox("正常");
                isOperating      = true;
                ticketNoBox.Text = zaiKo.TICKET_NO;
                return(DoBucketNo());
            }
            return(false);
        }
示例#3
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(userIdBox.Text))
                {
                    GlobalAccess.IsAuth = false;
                    msgBox.Text         = "请输入用户名";
                    userIdBox.Focus();
                    userIdBox.SelectAll();
                    return;
                }
                if (string.IsNullOrEmpty(passwordBox.Text))
                {
                    passwordBox.Text = " ";
                }


                LOGINUSEREntity user = DbAccess.GetUser(userIdBox.Text, passwordBox.Text);
                if (user == null)
                {
                    GlobalAccess.IsAuth = false;
                    msgBox.Text         = "用户名或密码错误,请重新输入";
                    userIdBox.Focus();
                    userIdBox.SelectAll();
                    return;
                }
                else
                {
                    GlobalAccess.UserId = user.USERID.ToString().Trim();
                    USERATTRIBUTEEntity userAttri = DbAccess.GetUserAttributeByUserId(GlobalAccess.UserId);
                    GlobalAccess.UserName = (userAttri == null || string.IsNullOrEmpty(userAttri.USERNAME)) ? string.Empty : userAttri.USERNAME.Trim();
                }

                TERMINALEntity term   = null;
                IPAddress[]    ipList = getIPAddress();

                for (int i = 0; i < ipList.Length; ++i)
                {
                    term = DbAccess.GetTermByIP(ipList[i].ToString());
                    if (term != null)
                    {
                        break;
                    }
                }

                if (term == null)
                {
                    MessageBox.Show("无法找到对应的终端信息");
                    return;
                }
                else
                {
                    GlobalAccess.StationNo   = term.STNO;
                    GlobalAccess.Proc        = term.PROC;
                    GlobalAccess.TermNo      = term.TERMINALNUMBER;
                    GlobalAccess.PrinterNo   = term.PRINTER_NO;
                    GlobalAccess.FixedWeight = term.FIXED_WEIGHT;
                }

                FNSYSTEMEntity systemInfo = DbAccess.GetSystemInfo();
                GlobalAccess.BagWeight = systemInfo.BAG_WEIGHT;

#if DEBUG
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Station No:" + GlobalAccess.StationNo);
                sb.AppendLine("Proc Id:" + GlobalAccess.Proc);
                sb.AppendLine("Term No:" + GlobalAccess.TermNo);
                sb.AppendLine("IP Address:" + term.IPADDRESS.Trim());
                GlobalAccess.ShowDebugInfo(sb.ToString());
#endif

                switch (GlobalAccess.Proc)
                {
                case "1":
                    Stockin1 frm1 = new Stockin1();
                    clearAll();
                    frm1.ShowDialog(this);
                    break;

                case "2":
                    Stockin2 frm2 = new Stockin2();
                    clearAll();
                    frm2.ShowDialog(this);
                    break;

                case "3":
                    Stockin3 frm3 = new Stockin3();
                    clearAll();
                    frm3.ShowDialog(this);
                    break;

                case "4":
                    Stockout frm4 = new Stockout();
                    clearAll();
                    frm4.ShowDialog(this);
                    break;

                default:
                    MessageBox.Show("无效的Program区分");
                    break;
                }
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
        }
示例#4
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            string schno = string.Empty;

            try
            {
                if (parentWindowType == 1)
                {
                    touCyaKu = DbAccess.GetTouCyaKu(GlobalAccess.StationNo);
                    if (touCyaKu == null)
                    {
                        msgBox.Text = "没有到达报告";
                        return;
                    }
                }
                if (string.IsNullOrEmpty(itemCodeBox.Text))
                {
                    msgBox.Text = "Item Name不能为空";
                    itemCodeBox.Focus();
                    itemCodeBox.SelectAll();
                    return;
                }
                else if (DoItemCode(itemCodeBox.Text) == false)
                {
                    return;
                }
                else if (string.IsNullOrEmpty(colorCodeBox.Text))
                {
                    msgBox.Text = "Color Code不能为空";
                    colorCodeBox.Focus();
                    colorCodeBox.SelectAll();
                    return;
                }
                else if (itemCountBox.Value == 0)
                {
                    msgBox.Text = "Item个数不能为0";
                    itemCountBox.Focus();
                    itemCountBox.Select();
                    return;
                }

                schno = DbAccess.generateScheduleNo();
                FNGSETEntity fngset = new FNGSETEntity();
                fngset.SCHNO      = schno;
                fngset.MOTOSTNO   = GlobalAccess.StationNo;
                fngset.BUCKET_NO  = bucketNoBox.Text;
                fngset.ZAIKEY     = itemCodeBox.Text;
                fngset.COLOR_CODE = colorCodeBox.Text;
                fngset.NYUSYUSU   = itemCountBox.Value;
                fngset.USERID     = GlobalAccess.UserId;
                fngset.USERNAME   = GlobalAccess.UserName;
                fngset.SYORIFLG   = "0";
                fngset.Save();

                if (parentWindowType == 1)
                {
                    DbAccess.callProcedure(schno, "unmanaged_stockin_1_start");
                }
                else if (parentWindowType == 2)
                {
                    DbAccess.callProcedure(schno, "unmanaged_stockin_2_start");
                }
                DbAccess.callAfterStockin(string.Empty);
                msgBox.Text = "设定成功";

                ClearAll();

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
            finally
            {
                DbAccess.UpdateFngset(schno);
            }
        }
示例#5
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            if (!matchMckey())
            {
                this.Close();
            }
            else
            {
                string schno = string.Empty;
                try
                {
                    FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo);
                    if (pickCtlEntity == null)
                    {
                        msgBox.Text = "当前没有作业";
                        return;
                    }

                    FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY);
                    if (hansoEntity == null)
                    {
                        msgBox.Text = "没有搬送数据";
                        return;
                    }

                    if (hansoEntity.HJYOTAIFLG != "6")
                    {
                        msgBox.Text = "Bucket还没有到达";
                        return;
                    }

                    if (!DoBucket())
                    {
                        return;
                    }

                    if (itemCountBox.Value == 0)
                    {
                        msgBox.Text = "请先称重或输入Item个数";
                        itemCountBox.Focus();
                        itemCountBox.Select();
                        return;
                    }

                    schno = DbAccess.generateScheduleNo();
                    FNGSETEntity fngset = new FNGSETEntity();
                    fngset.SCHNO          = schno;
                    fngset.MOTOSTNO       = GlobalAccess.StationNo;
                    fngset.UNIT_WEIGHT    = Convert.ToDecimal(unitWeightBox.Text) / 1000;
                    fngset.MEASURE_WEIGHT = (itemCountBox.Value * Convert.ToDecimal(unitWeightBox.Text)) / 1000 > 99.9999m ? 99.9999m : (itemCountBox.Value * Convert.ToDecimal(unitWeightBox.Text)) / 1000;
                    fngset.NYUSYUSU       = itemCountBox.Value;
                    fngset.MEMO           = string.IsNullOrEmpty(remarkBox.Text) ? " " : remarkBox.Text.Trim();
                    fngset.USERID         = GlobalAccess.UserId;
                    fngset.USERNAME       = GlobalAccess.UserName;
                    fngset.SYORIFLG       = "0";
                    fngset.TICKET_NO      = ticketNoBox.Text;
                    fngset.BUCKET_NO      = bucketNoBox.Text;
                    fngset.BAG_FLAG       = chkUsingPlasticBag.Checked ? "1" : "0";
                    fngset.Save();
                    DbAccess.callProcedure(schno, "stock_back");
                    DbAccess.callAfterStockin(string.Empty);
                    msgBox.Text = "设定成功";
                    //ClearAll();
                    this.Close();
                }
                catch (Exception ex)
                {
                    msgBox.Text = ex.Message;
                }
                finally
                {
                    DbAccess.UpdateFngset(schno);
                }
            }
        }
示例#6
0
 private void DoBucketNo(string bucketNo)
 {
     FMBUCKETEntity bucket = DbAccess.GetBucket(bucketNo);
 }
示例#7
0
 public static bool IsBucketInTransportation(string bucketNo)
 {
     return(DbAccess.GetHansoByBucketNo(bucketNo) == null ? false : true);
 }
示例#8
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            string schno = string.Empty;

            try
            {
                if (isOperating == false)
                {
                    msgBox.Text = "当前没有作业";
                    return;
                }

                FNPICK_CTLEntity pickCtlEntity = DbAccess.GetPick_Ctl(GlobalAccess.TermNo);
                if (pickCtlEntity == null)
                {
                    msgBox.Text = "当前没有作业";
                    return;
                }

                FNHANSOEntity hansoEntity = DbAccess.GetHanSo(pickCtlEntity.MCKEY);
                if (hansoEntity == null)
                {
                    msgBox.Text = "没有搬送数据";
                    return;
                }

                if (hansoEntity.HJYOTAIFLG != "6")
                {
                    msgBox.Text = "Bucket还没有到达";
                    return;
                }

                if (pickingType != PickingType.Abnormal)
                {
                    if (pickingType != PickingType.Total)
                    {
                        if (string.IsNullOrEmpty(this.newBucketNoBox.Text))
                        {
                            msgBox.Text = "请输入BucketNo";
                            newBucketNoBox.Focus();
                            newBucketNoBox.SelectAll();
                            return;
                        }
                        else if (DbAccess.GetBucket(this.newBucketNoBox.Text) == null)
                        {
                            msgBox.Text = "空箱未登录";
                            newBucketNoBox.Focus();
                            newBucketNoBox.SelectAll();
                            return;
                        }
                    }

                    if (pickingType != PickingType.Cycle)
                    {
                        if (string.IsNullOrEmpty(this.pickingCountBox.Text))
                        {
                            msgBox.Text = "Picking数不能为空";
                            receiveMessageBtn.Focus();
                            return;
                        }
                    }
                }

                schno = DbAccess.generateScheduleNo();
                FNGSETEntity fngset = new FNGSETEntity();
                fngset.SCHNO    = schno;
                fngset.MOTOSTNO = GlobalAccess.StationNo;
                if (pickingType != PickingType.Abnormal)
                {
                    fngset.BUCKET_NO = newBucketNoBox.Text;
                    if (pickingType != PickingType.Cycle)
                    {
                        fngset.NYUSYUSU = Decimal.Parse(this.pickingCountBox.Text);
                    }
                }
                fngset.SYORIFLG   = "0";
                fngset.USERID     = GlobalAccess.UserId;
                fngset.USERNAME   = GlobalAccess.UserName;
                fngset.PRINTER_NO = GlobalAccess.PrinterNo;
                fngset.Save();

                DbAccess.callProcedure(schno, "picking_start");
                DbAccess.callAfterStockin(string.Empty);
                msgBox.Text = "设定成功";

                if (pickingType != PickingType.Abnormal)
                {
                    LabelPublish frm = new LabelPublish(sijis);
                    frm.ShowDialog(this);
                }
                ClearAll();
                isOperating = false;
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
            finally
            {
                DbAccess.UpdateFngset(schno);
            }
        }
示例#9
0
 public static bool IsBucketInLocation(string bucketNo)
 {
     return(DbAccess.GetLocationByBucketNo(bucketNo) == null ? false : true);
 }
示例#10
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            string schno = string.Empty;

            try
            {
                if (statusBox.Text == "系统Offline")
                {
                    return;
                }

                if (statusBox.Text == "通过")
                {
                    return;
                }

                if (_isOperating == false)
                {
                    return;
                }

                if (_touCyaKu == null)
                {
                    msgBox.Text = "没有到达报告";
                    return;
                }

                if (statusBox.Text == "空箱登录模式" || statusBox.Text == "正常")
                {
                    if (statusBox.Text == "正常")
                    {
                        FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo);
                        if (station == null)
                        {
                            msgBox.Text = "无法取得站台信息";
                            return;
                        }

                        if (station.NYUSYUMODE == Nyusyumode.Empty_Bucket)
                        {
                            setStatusBox("空箱登录模式");
                            setUIOnEmptyBucketMode();
                            return;
                        }

                        if (ticketNoBox.Text.Trim() == string.Empty)
                        {
                            msgBox.Text = "TicketNo不能为空";
                            ticketNoBox.Focus();
                            ticketNoBox.SelectAll();
                            return;
                        }
                        if (effectiveTicketNo != ticketNoBox.Text)
                        {
                            msgBox.Text = "TicketNo无效";
                            ticketNoBox.Focus();
                            ticketNoBox.SelectAll();
                            return;
                        }
                        if (string.IsNullOrEmpty(unitWeightBox.Text))
                        {
                            msgBox.Text = "请先获得单位重量";
                            unitWeightLoadBtn.Focus();
                            return;
                        }

                        if (decimal.Parse(unitWeightBox.Text) == 0)
                        {
                            msgBox.Text = "单位重量必须大于0";
                            unitWeightBox.Focus();
                            unitWeightBox.SelectAll();
                            return;
                        }
                        if (string.IsNullOrEmpty(itemWeightBox.Text))
                        {
                            msgBox.Text = "请先读取Item重量";
                            weightLoadBtn.Focus();
                            return;
                        }
                        if (itemCountBox.Value <= 0)
                        {
                            msgBox.Text = "Item数量必须大于0";
                            itemCountBox.Focus();
                            itemCountBox.Select();
                            return;
                        }
                        if (Encoding.Default.GetByteCount(this.memoBox.Text) > memoBox.MaxLength)
                        {
                            msgBox.Text = "备注超长(规定长度是100个半角字符,1个汉字等于2个半角字符)";
                            memoBox.Focus();
                            memoBox.SelectAll();
                            return;
                        }
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo);
                        if (station == null)
                        {
                            msgBox.Text = "无法取得站台信息";
                            return;
                        }

                        if (station.NYUSYUMODE == Nyusyumode.Normal)
                        {
                            setStatusBox("空箱登录模式");
                            setUIOnNormalMode();
                            return;
                        }

                        if (string.IsNullOrEmpty(itemWeightBox.Text))
                        {
                            msgBox.Text = "请先读取Item重量";
                            weightLoadBtn.Focus();
                            return;
                        }

                        if (decimal.Parse(itemWeightBox.Text) == 0)
                        {
                            msgBox.Text = "Item重量不可为0";
                            weightLoadBtn.Focus();
                            return;
                        }
                    }
                    schno = DbAccess.generateScheduleNo();
                    FNGSETEntity fngset = new FNGSETEntity();
                    fngset.SCHNO    = schno;
                    fngset.MOTOSTNO = GlobalAccess.StationNo;
                    fngset.SYORIFLG = "0";
                    fngset.USERID   = GlobalAccess.UserId;
                    fngset.USERNAME = GlobalAccess.UserName;
                    if (statusBox.Text == "正常")
                    {
                        fngset.UNIT_WEIGHT    = Convert.ToDecimal(unitWeightBox.Text) / 1000;
                        fngset.MEASURE_WEIGHT = Convert.ToDecimal(itemWeightBox.Text);
                        fngset.NYUSYUSU       = itemCountBox.Value;
                        fngset.MEMO           = string.IsNullOrEmpty(memoBox.Text.Trim()) ? " " : memoBox.Text;
                        fngset.TICKET_NO      = effectiveTicketNo;
                        fngset.SAINYUKBN      = chkReStockIn.Checked ? "1" : " ";
                        fngset.BAG_FLAG       = chkUsingPlasticBag.Checked ? "1" : "0";
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        fngset.PACKING_WEIGHT = Convert.ToDecimal(itemWeightBox.Text);
                    }
                    fngset.Save();
                    DbAccess.callProcedure(schno, "stockin_1");
                    if (statusBox.Text == "正常")
                    {
                        FNZAIKOEntity zaikoEntity = DbAccess.GetZaiKoByTicketNo(effectiveTicketNo);
                        _preZaiKey     = zaikoEntity.ZAIKEY;
                        _preColorCode  = zaikoEntity.COLOR_CODE;
                        _preUnitWeight = decimal.Parse(unitWeightBox.Text);
                        DbAccess.callAfterStockin(zaikoEntity.WEIGHT_REPORT_COMPLETE_FLAG);
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        DbAccess.callAfterStockin(string.Empty);
                    }
                    msgBox.Text = "设定成功";
                    ClearAll();
                    ticketNoBox.Focus();
                    ticketNoBox.SelectAll();
                    _isOperating = false;
                    isRangeError = false;
                }
                else
                {
                    exportBtn.PerformClick();
                }
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
            finally
            {
                DbAccess.UpdateFngset(schno);
            }
        }
示例#11
0
        private void unitWeightLoadBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (statusBox.Text == "系统Offline")
                {
                    return;
                }

                if (statusBox.Text == "通过")
                {
                    return;
                }

                if (_isOperating == false)
                {
                    return;
                }

                if (_zaiKo == null)
                {
                    msgBox.Text = "请输入TicketNo";
                    return;
                }
                if (_zKey == null)
                {
                    msgBox.Text = "没有此Item主数据";
                    return;
                }

                int count = 0;;
                try
                {
                    count = Convert.ToInt32(checkCountBox.Value);
                }
                catch (Exception)
                {
                    msgBox.Text = "请输入检查数量";
                    return;
                }
                unitWeightLoadBtn.Enabled = false;
                decimal weight = GetUnitWeight(); //称重,取单位重量,错误返回-1
                unitWeightLoadBtn.Enabled = true;
                if (weight == -2)
                {
                    msgBox.Text        = "无法取得安定的计量器数值";
                    unitWeightBox.Text = string.Empty;
                    return;
                }

                if (weight != -1)
                {
                    msgBox.Text = "";
                    decimal unitWeight = decimal.Round(weight / count, 7, MidpointRounding.AwayFromZero);
                    unitWeightBox.Text = unitWeight.ToString();
                    //计算误差
                    if (_zKey.MASTER_UNIT_WEIGHT > 0)
                    {
                        decimal error = decimal.Round((unitWeight * 100 / (_zKey.MASTER_UNIT_WEIGHT * 1000)), 1, MidpointRounding.AwayFromZero);
                        unitWeightErrorBox.Text = error.ToString();
                        if (error > Convert.ToDecimal(unitWeightRangeLimitToBox.Text) || error < Convert.ToDecimal(unitWeightRangeLimitFromBox.Text))
                        {
                            DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Range_Error);
                            OutOfRangeWarning frm = new OutOfRangeWarning("原单位重量", unitWeightErrorBox.Text, unitWeightRangeLimitFromBox.Text, unitWeightRangeLimitToBox.Text);
                            frm.ShowDialog(this);
                            msgBox.Text         = "超出范围";
                            this.setBtn.Enabled = false;
                        }
                        else
                        {
                            msgBox.Text         = string.Empty;
                            this.setBtn.Enabled = true;
                        }
                    }
                    else
                    {
                        unitWeightErrorBox.Text = "100";
                    }
                }
                else
                {
                    msgBox.Text = "通信错误";
                    return;
                }
            }
            catch (Exception ex)
            {
                unitWeightLoadBtn.Enabled = true;
                msgBox.Text = ex.Message;
            }
        }
示例#12
0
        private void DoTicketNo()
        {
            string ticketNo = ticketNoBox.Text;

            if (string.IsNullOrEmpty(ticketNo.Trim()))
            {
                return;
            }

            _zaiKo = DbAccess.GetZaiKoByTicketNo(ticketNo);
            if (_zaiKo == null)
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                msgBox.Text         = "库存未登录";
                itemCodeBox.Text    = string.Empty;
                itemNameBox1.Text   = string.Empty;
                itemNameBox2.Text   = string.Empty;
                itemNameBox3.Text   = string.Empty;
                colorCodeBox.Text   = string.Empty;
                sectionBox.Text     = string.Empty;
                lineBox.Text        = string.Empty;
                planCountBox.Text   = string.Empty;
                planWeightBox.Text  = string.Empty;
                unitWeightBox.Text  = string.Empty;
                measureFlagBox.Text = string.Empty;
                ticketNoBox.Focus();
                ticketNoBox.SelectAll();
                return;
            }

            if (_zaiKo.STORAGE_PLACE_FLAG == "0") //非平库
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                msgBox.Text         = "库存已存在";
                itemCodeBox.Text    = string.Empty;
                itemNameBox1.Text   = string.Empty;
                itemNameBox2.Text   = string.Empty;
                itemNameBox3.Text   = string.Empty;
                colorCodeBox.Text   = string.Empty;
                sectionBox.Text     = string.Empty;
                lineBox.Text        = string.Empty;
                planCountBox.Text   = string.Empty;
                planWeightBox.Text  = string.Empty;
                unitWeightBox.Text  = string.Empty;
                measureFlagBox.Text = string.Empty;
                ticketNoBox.Focus();
                ticketNoBox.SelectAll();
                return;
            }

            _zKey = DbAccess.GetManagedZKey(_zaiKo.ZAIKEY);
            if (_zKey == null)
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                msgBox.Text         = "没有此Item主数据";
                itemCodeBox.Text    = string.Empty;
                itemNameBox1.Text   = string.Empty;
                itemNameBox2.Text   = string.Empty;
                itemNameBox3.Text   = string.Empty;
                colorCodeBox.Text   = string.Empty;
                sectionBox.Text     = string.Empty;
                lineBox.Text        = string.Empty;
                planCountBox.Text   = string.Empty;
                planWeightBox.Text  = string.Empty;
                unitWeightBox.Text  = string.Empty;
                measureFlagBox.Text = string.Empty;
                ticketNoBox.Focus();
                ticketNoBox.SelectAll();
                return;
            }

            msgBox.Clear();

            itemCodeBox.Text           = _zKey.ZAIKEY;
            itemNameBox1.Text          = _zKey.ZKNAME1;
            itemNameBox2.Text          = _zKey.ZKNAME2;
            itemNameBox3.Text          = _zKey.ZKNAME3;
            colorCodeBox.Text          = _zaiKo.COLOR_CODE;
            sectionBox.Text            = _zaiKo.MADE_SECTION;
            lineBox.Text               = _zaiKo.MADE_LINE;
            planCountBox.Text          = _zaiKo.PLAN_QTY.ToString();
            planWeightBox.Text         = _zaiKo.PLAN_WEIGHT.ToString();
            unitWeightBox.Text         = (_zKey.MASTER_UNIT_WEIGHT * 1000).ToString();
            checkCountBox.Value        = _zKey.MEASURE_QTY;
            measureFlagBox.Text        = _zKey.MEASURE_FLAG.Trim() == "0" ? "不要" : "要";
            memoBox.Text               = _zaiKo.MEMO;
            chkUsingPlasticBag.Checked = _zKey.BAG_FLAG.Trim() == "1";
            fixedWeightBox.Text        = (GlobalAccess.FixedWeight * 1000).ToString();

            DoRange(_zaiKo); //处理原单位,入库许可上下限

            if (_preZaiKey != _zKey.ZAIKEY || _preColorCode != _zaiKo.COLOR_CODE)
            {
                if (_zKey.MEASURE_FLAG.Trim() != "0")
                {
                    unitWeightBox.Text = string.Empty;
                }
            }
            else
            {
                unitWeightBox.Text = _preUnitWeight.ToString();
            }
        }
示例#13
0
        private bool DoTouCyaKu(FNTOUCYAKUEntity touCyaKu)
        {
            bucketNoBox.Text = touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR" ? string.Empty : touCyaKu.BUCKET_NO;
            if (touCyaKu.BUCKET_NO.Trim().ToUpper() == "BR")
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                setStatusBox("条码未读取");
                setUIOnExport();
                _isOperating = true;
                return(false);
            }

            FNHANSOEntity hanSo = DbAccess.GetHanSo(touCyaKu.MCKEY);

            if (hanSo == null)
            {
                setStatusBox("排出");
                touCyaKu.SYORIFLG = "1";
                touCyaKu.Save();
                setUIOnExport();
                _isOperating = true;
                return(false);
            }

            if (hanSo.SAGYOKBN == Sagyokbn.ReInput) //再入库
            {
                setStatusBox("通过");
                ShowInfo(hanSo.SYSTEMID);
                return(false);
            }

            if (touCyaKu.HEIGHT_FLAG == "3")    //货形高低异常
            {
                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error);
                setStatusBox("Bucket高度异常");
                setUIOnExport();
                _isOperating = true;
                return(false);
            }

            FNSTATIONEntity station = DbAccess.GetStation(GlobalAccess.StationNo);

            if (station == null)
            {
                return(false);
            }

            if (station.NYUSYUMODE == Nyusyumode.Empty_Bucket)
            {
                setStatusBox("空箱登录模式");
                _isOperating = true;
                return(true);
            }

            if (station.NYUSYUMODE == Nyusyumode.Normal)    //入库模式
            {
                _bucket = DbAccess.GetBucket(touCyaKu.BUCKET_NO);
                if (_bucket == null)
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                    setStatusBox("空箱未登录");
                    setUIOnExport();
                    _isOperating = true;
                    return(false);
                }
                bucketWeightBox.Text = _bucket.PACKING_WEIGHT.ToString();

                if (_bucket.HEIGHT_FLAG != touCyaKu.HEIGHT_FLAG)
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Height_Error);
                    setStatusBox("Bucket高度异常");
                    setUIOnExport();
                    _isOperating = true;
                    return(false);
                }

                if (DbAccess.IsBucketInAutoWarehouse(_bucket.BUCKET_NO) ||
                    DbAccess.IsBucketInLocation(_bucket.BUCKET_NO))
                {
                    DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Data_Error);
                    setStatusBox("Bucket重复");
                    setUIOnExport();
                    _isOperating = true;
                    return(false);
                }

                msgBox.Clear();
                setStatusBox("正常");
                _isOperating = true;
            }
            return(false);
        }
示例#14
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            string schno = string.Empty;

            try
            {
                if (statusBox.Text == "系统Offline")
                {
                    return;
                }

                if (!DoBucketNo())
                {
                    bucketNoBox.Focus();
                    bucketNoBox.SelectAll();
                    return;
                }

                if (statusBox.Text == "正常")
                {
                    if (ticketNoBox.Text.Trim() == string.Empty)
                    {
                        msgBox.Text = "TicketNo不能为空";
                        ticketNoBox.Focus();
                        ticketNoBox.SelectAll();
                        return;
                    }

                    if (effectiveTicketNo != ticketNoBox.Text)
                    {
                        msgBox.Text = "TicketNo无效";
                        ticketNoBox.Focus();
                        ticketNoBox.SelectAll();
                        return;
                    }

                    if (string.IsNullOrEmpty(unitWeightBox.Text))
                    {
                        msgBox.Text = "单位重量不能为空";
                        unitWeightLoadBtn.Focus();
                        return;
                    }

                    if (Encoding.Default.GetByteCount(this.memoBox.Text) > memoBox.MaxLength)
                    {
                        msgBox.Text = "备注超长(规定长度是100个半角字符,1个汉字等于2个半角字符)";
                        memoBox.Focus();
                        memoBox.SelectAll();
                        return;
                    }

                    schno = DbAccess.generateScheduleNo();
                    FNGSETEntity fngset = new FNGSETEntity();
                    fngset.SCHNO       = schno;
                    fngset.MOTOSTNO    = GlobalAccess.StationNo;
                    fngset.UNIT_WEIGHT = Convert.ToDecimal(unitWeightBox.Text) / 1000;
                    fngset.MEMO        = string.IsNullOrEmpty(memoBox.Text.Trim()) ? " " : memoBox.Text;
                    fngset.USERID      = GlobalAccess.UserId;
                    fngset.USERNAME    = GlobalAccess.UserName;
                    fngset.SYORIFLG    = "0";
                    fngset.TICKET_NO   = effectiveTicketNo;
                    fngset.BUCKET_NO   = bucketNoBox.Text;
                    fngset.SAINYUKBN   = chkReStockIn.Checked ? "1" : " ";
                    fngset.BAG_FLAG    = chkUsingPlasticBag.Checked ? "1" : "0";
                    fngset.Save();

                    DbAccess.callProcedure(schno, "stockin_2");
                    DbAccess.callAfterStockin(string.Empty);

                    msgBox.Text = "设定成功";
                    bucketNoBox.Focus();
                    bucketNoBox.SelectAll();

                    FNZAIKOEntity zaikoEntity = DbAccess.GetZaiKoByTicketNo(effectiveTicketNo);
                    _preZaiKey     = _zKey.ZAIKEY;
                    _preColorCode  = zaikoEntity.COLOR_CODE;
                    _preUnitWeight = decimal.Parse(unitWeightBox.Text);
                    ClearAll();
                    bucketNoBox.Focus();
                    bucketNoBox.SelectAll();
                }
                else
                {
                    msgBox.Text = "非正常模式下不能进行设定";
                }
            }
            catch (Exception ex)
            {
                msgBox.Text = ex.Message;
            }
            finally
            {
                DbAccess.UpdateFngset(schno);
            }
        }
示例#15
0
        private void weightLoadBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (statusBox.Text == "系统Offline")
                {
                    return;
                }

                if (isOperating == false)
                {
                    return;
                }

                if (statusBox.Text == "正常")
                {
                    if (zaiKo == null)
                    {
                        msgBox.Text = "请输入TicketNo";
                        return;
                    }
                    if (zKey == null)
                    {
                        msgBox.Text = "没有此Item主数据";
                        return;
                    }
                    if (bucket == null)
                    {
                        msgBox.Text = "Bucket未登录";
                        return;
                    }
                    if (string.IsNullOrEmpty(unitWeightBox.Text))
                    {
                        msgBox.Text = "请先获得单位重量";
                        return;
                    }
                    if (decimal.Parse(unitWeightBox.Text) == 0)
                    {
                        msgBox.Text = "单位重量必须大于0";
                        return;
                    }
                }
                weightLoadBtn.Enabled = false;
                decimal weight = GetWeight();   //称重,错误返回-1
                weightLoadBtn.Enabled = true;
                if (weight == -2)
                {
                    msgBox.Text        = "无法取得安定的计量器数值";
                    itemWeightBox.Text = string.Empty;
                    itemCountBox.Value = itemCountBox.Minimum;
                    return;
                }
                if (weight != -1)
                {
                    if (bucket != null)
                    {
                        decimal temp = weight - bucket.PACKING_WEIGHT - GlobalAccess.FixedWeight;
                        if (plasticBagStatusBox.Text == "有")
                        {
                            temp -= GlobalAccess.BagWeight;
                        }
                        itemWeightBox.Text = temp < 0 ? "0" : temp.ToString();
                    }
                    else
                    {
                        itemWeightBox.Text = weight < 0 ? "0" : weight.ToString();
                    }

                    if (statusBox.Text == "正常")
                    {
                        int count = Convert.ToInt32(decimal.Truncate(decimal.Parse(itemWeightBox.Text) / decimal.Parse(unitWeightBox.Text)));
                        itemCountBox.Value = count;
                        //计算误差
                        if (zaiKo.PLAN_QTY > 0)
                        {
                            decimal error = decimal.Round((count * 100 / zaiKo.PLAN_QTY), 1, MidpointRounding.AwayFromZero);
                            itemWeightErrorBox.Text = error.ToString();
                            if (error > Convert.ToDecimal(itemWeightRangeLimitToBox.Text) || error < Convert.ToDecimal(itemWeightRangeLimitFromBox.Text))
                            {
                                DbAccess.callSwitchOnLight(GlobalAccess.StationNo, LightType.Range_Error);
                                OutOfRangeWarning frm = new OutOfRangeWarning("产品重量", itemWeightErrorBox.Text, itemWeightRangeLimitFromBox.Text, itemWeightRangeLimitToBox.Text);
                                frm.ShowDialog(this);
                                msgBox.Text  = "超出范围";
                                isRangeError = true;
                                //manCheck.Checked = true;
                            }
                            else
                            {
                                msgBox.Text = string.Empty;
                            }
                        }
                        else
                        {
                            itemWeightErrorBox.Text = "100";
                        }
                    }
                }
                else
                {
                    msgBox.Text = "通信错误";
                    return;
                }
            }
            catch (Exception ex)
            {
                weightLoadBtn.Enabled = true;
                msgBox.Text           = ex.Message;
            }
        }
示例#16
0
 public static bool IsBucketInFlatWarehouse(string bucketNo)
 {
     return(DbAccess.GetZaiKoInFlatWarehouseByBucketNo(bucketNo) == null ? false : true);
 }
示例#17
0
        private void setBtn_Click(object sender, EventArgs e)
        {
            string schno = string.Empty;

            try
            {
                if (statusBox.Text == "系统Offline")
                {
                    return;
                }

                if (isOperating == false)
                {
                    return;
                }

                if (statusBox.Text == "空箱登录模式" || statusBox.Text == "正常")
                {
                    if (statusBox.Text == "正常")
                    {
                        if (string.IsNullOrEmpty(unitWeightBox.Text))
                        {
                            msgBox.Text = "请先获得单位重量";
                            unitWeightBox.Focus();
                            unitWeightBox.SelectAll();
                            return;
                        }

                        if (string.IsNullOrEmpty(itemWeightBox.Text))
                        {
                            msgBox.Text = "请先读取Item重量";
                            itemWeightBox.Focus();
                            itemWeightBox.SelectAll();
                            return;
                        }

                        if (itemCountBox.Value <= 0)
                        {
                            msgBox.Text = "Item数量必须大于0";
                            weightLoadBtn.Focus();
                            return;
                        }
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        if (string.IsNullOrEmpty(itemWeightBox.Text))
                        {
                            msgBox.Text = "请先读取Item重量";
                            return;
                        }

                        if (decimal.Parse(itemWeightBox.Text) == 0)
                        {
                            msgBox.Text = "Item重量不可为0";
                            weightLoadBtn.Focus();
                            return;
                        }
                    }

                    schno = DbAccess.generateScheduleNo();
                    FNGSETEntity fngset = new FNGSETEntity();
                    fngset.SCHNO    = schno;
                    fngset.SYORIFLG = "0";
                    fngset.MOTOSTNO = GlobalAccess.StationNo;
                    fngset.USERID   = GlobalAccess.UserId;
                    fngset.USERNAME = GlobalAccess.UserName;
                    if (statusBox.Text == "正常")
                    {
                        fngset.UNIT_WEIGHT    = Convert.ToDecimal(unitWeightBox.Text) / 1000;
                        fngset.MEASURE_WEIGHT = Convert.ToDecimal(itemWeightBox.Text);
                        fngset.NYUSYUSU       = itemCountBox.Value;
                        //fngset.TICKET_NO = ticketNoBox.Text;
                        fngset.BUCKET_NO = bucketNoBox.Text;
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        fngset.PACKING_WEIGHT = Convert.ToDecimal(itemWeightBox.Text);
                    }
                    fngset.Save();
                    DbAccess.callProcedure(schno, "stockin_3");
                    if (statusBox.Text == "正常")
                    {
                        FNZAIKOEntity zaikoEntity = DbAccess.GetZaiKoByBucketNo(bucketNoBox.Text);
                        DbAccess.callAfterStockin(zaikoEntity.WEIGHT_REPORT_COMPLETE_FLAG);
                    }
                    else if (statusBox.Text == "空箱登录模式")
                    {
                        DbAccess.callAfterStockin(string.Empty);
                    }
                    msgBox.Text = "设定成功";
                    ClearAll();
                    weightLoadBtn.Focus();
                    isOperating  = false;
                    isRangeError = false;
                }
                else
                {
                    exportBtn.PerformClick();
                }
            }
            catch (Exception ex)
            {
                manCheck.Checked = true;
                msgBox.Text      = ex.Message;
            }
            finally
            {
                DbAccess.UpdateFngset(schno);
            }
        }
示例#18
0
        private void CheckTask()
        {
            pick_ctl = DbAccess.GetPick_Ctl(GlobalAccess.TermNo);
            if (pick_ctl == null || string.IsNullOrEmpty(pick_ctl.MCKEY == null ? pick_ctl.MCKEY : pick_ctl.MCKEY.Trim()))   //无拣选预定
            {
                ClearAll();
                return;
            }

            FNHANSOEntity hanso = DbAccess.GetHanSo(pick_ctl.MCKEY.Trim());

            if (hanso == null)
            {
                msgBox.Text = "没有搬送数据";
                WriteLog("无法找到Hanso数据,Mckey为" + pick_ctl.MCKEY.Trim());
                return;
            }

            if (hanso.HJYOTAIFLG != "6") //Bucket未到达
            {
                return;
            }

            isOperating = true;                        //操作状态,不再刷数据库

            cancelBtn.Enabled = hanso.SAGYOKBN != "7"; //直行搬送,取消按钮不可按下


            try
            {
                mcKey = GetTaskMckey();  //取得MCKEY,PickingType,剩余作业数,剩余拣选数
            }
            catch (Exception ex)
            {
                throw new Exception("GetTaskMckey出错:" + ex.Message);
            }

            if (string.IsNullOrEmpty(mcKey))
            {
                msgBox.Text = "无法获得作业内容";
                WriteLog("GetTaskMckey无法找到对应数据");
                return;
            }

            if (pickingType == PickingType.Return)  //如果是回库作业,弹出回库窗口
            {
                StockBack frm = new StockBack(mcKey);
                frm.ShowDialog(this);
                isOperating = false;    //回库结束,开启刷数据库
                return;
            }

            sijis = DbAccess.GetSiJis(mcKey);
            if (sijis == null || sijis.Count == 0)
            {
                msgBox.Text = "没有指示数据";
                WriteLog(string.Format("无法找到siji数据,mckey{0}", mcKey));
                return;
            }

            if (sijis[0].ZAIKEY == null)
            {
                msgBox.Text = "无法找到siji.zaikey";
                WriteLog("无法找到siji.zaikey");
                return;
            }

            zKey = DbAccess.GetManagedZKey(sijis[0].ZAIKEY);
            if (zKey == null)
            {
                msgBox.Text = "无法找到ZAIKEY数据";
                WriteLog(string.Format("无法找到ZAIKEY数据,zkey{0}", zKey));
                return;
            }

            originalBucketNoBox.Text = hanso.BUCKET_NO;
            FMBUCKETEntity originalBucket = DbAccess.GetBucket(hanso.BUCKET_NO);

            originalBucketWeightBox.Text = originalBucket == null ? string.Empty : originalBucket.PACKING_WEIGHT.ToString();
            ticketNoBox.Text             = sijis[0].TICKET_NO;
            colorCodeBox.Text            = sijis[0].COLOR_CODE;
            itemCodeBox.Text             = zKey.ZAIKEY;
            itemName1Box.Text            = zKey.ZKNAME1;
            itemName2Box.Text            = zKey.ZKNAME2;
            itemName3Box.Text            = zKey.ZKNAME3;

            zaikoEntity                = DbAccess.GetZaiKoBySystemId(hanso.SYSTEMID);
            unitWeightBox.Text         = zaikoEntity == null ? string.Empty : (zaikoEntity.REAL_UNIT_WEIGHT * 1000).ToString();
            remainJobBox.Text          = remainCount.ToString();
            totalStockoutCountBox.Text = remainPickingQty.ToString();

            planCount = 0;
            foreach (FNSIJIEntity siji in sijis)    //作业数量
            {
                planCount += siji.NYUSYUSU;
            }

            //全拣选时不可输入BucketNo
            newBucketNoBox.ReadOnly = (pickingType == PickingType.Total);


            //收、发计量报告按钮在盘库时不可用
            sendMessageBtn.Enabled    = (pickingType != PickingType.Cycle);
            receiveMessageBtn.Enabled = (pickingType != PickingType.Cycle);

            //BucketNo不一致时,出库取消按钮不可用
            cancelBtn.Enabled = pick_ctl.BUCKETREADING_FLG != "2";

            if (pickingType == PickingType.Total)
            {
                msgBox.Clear();
                emptyBucketPositionBox.Text = "无设置";
                jobTypeBox.Text             = "全拣选";
                jobCountBox.Text            = planCount.ToString();
                newBucketNoBox.Text         = hanso.BUCKET_NO;
                //全拣选时自动读出重量,计量器自动送信
                if (DoBucketNoOnTotal())
                {
                    sendMessageBtn.PerformClick();
                }
            }
            if (pickingType == PickingType.Reverse)
            {
                msgBox.Clear();
                emptyBucketPositionBox.Text = "设置在称重机前";
                jobTypeBox.Text             = "反拣选";
                jobCountBox.Text            = planCount.ToString();
                newBucketNoBox.Focus();
                newBucketNoBox.SelectAll();
            }
            if (pickingType == PickingType.Normal || pickingType == PickingType.Subdivided)
            {
                msgBox.Clear();
                emptyBucketPositionBox.Text = "设置于称重机上";
                jobTypeBox.Text             = pickingType == PickingType.Normal ? "拣选" : "拣选(细分)";
                jobCountBox.Text            = planCount.ToString();
                newBucketNoBox.Focus();
                newBucketNoBox.SelectAll();
            }
            if (pickingType == PickingType.Abnormal)
            {
                msgBox.Clear();
                emptyBucketPositionBox.Text = "无设置";
                if (pick_ctl.BUCKETREADING_FLG == "2")
                {
                    jobTypeBox.Text = "Bucket不一致";
                }
            }
            if (pickingType == PickingType.Cycle)
            {
                msgBox.Clear();
                jobCountBox.Text    = "0";
                newBucketNoBox.Text = hanso.BUCKET_NO;
                FMBUCKETEntity bucketEntity = DbAccess.GetBucket(hanso.BUCKET_NO);
                newBucketWeightBox.Text     = bucketEntity == null ? string.Empty : bucketEntity.PACKING_WEIGHT.ToString();
                emptyBucketPositionBox.Text = "无设置";
                jobTypeBox.Text             = "盘库";
            }
        }