示例#1
0
        private void cboLh_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (PackingBoxService.IsExistsNoGenerateBox())
            {
                if (MetroMessageBox.Show(this, "存在未生成交接单的箱记录,是否继续未生产交接单的箱记录?",
                                         "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    currentBoxList = PackingBoxService.GetUnGenerateBoxListWithDetail();
                    grid.Rows.Clear();
                    //errorCount = 0;
                    if (currentBoxList != null && currentBoxList.Count > 0)
                    {
                        foreach (PBBoxInfo item in currentBoxList)
                        {
                            AddBoxDetailGrid(item);
                        }
                        string lh = currentBoxList.First().LH;
                        currentLh  = lh;
                        cboLh.Text = lh;
                    }

                    UpdateBtnDocDetailStatus();
                    UpdateTotalInfo();
                }
                else
                {
                    if (string.IsNullOrEmpty(currentLh))
                    {
                        cboLh.SelectedItem = null;
                    }
                    else
                    {
                        cboLh.Text = currentLh;
                    }
                }
            }
            else
            {
                if (grid.Rows.Count > 0)
                {
                    if (MetroMessageBox.Show(this, "是否删除列表箱记录?",
                                             "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        List <string> huList = new List <string>();
                        foreach (DataGridViewRow row in grid.Rows)
                        {
                            if (!huList.Contains((row.Tag as PBBoxInfo).HU))
                            {
                                huList.Add((row.Tag as PBBoxInfo).HU);
                            }
                        }
                        if (PackingBoxService.DeleteBoxByHu(huList))
                        {
                            grid.Rows.Clear();
                            currentBoxList.Clear();
                        }
                    }
                }
            }
        }
示例#2
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            string lh = boxList != null && boxList.Count > 0 ? boxList.First().LH : "";

            if (string.IsNullOrEmpty(lh))
            {
                ShowStatusInfo(false, "楼号为空,不能生成交接单");
                return;
            }
            SapResult result = SAPDataService.GenerateDocInfo(
                SysConfig.LGNUM, SysConfig.CurrentLoginUser.UserId, lh,
                boxList.FindAll(i => i.LH == lh && i.PACKRESULT == "S" && i.RESULT == "S").Select(i => i.HU).ToList());

            if (result.STATUS == "E")
            {
                ShowStatusInfo(false, result.MSG);
            }
            else
            {
                PackingBoxService.UpdateBoxGenerated(lh);
                if (OnGenerateSuccess != null)
                {
                    OnGenerateSuccess(lh);
                }
                MetroMessageBox.Show(this, "生成交接单成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Close();
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <PBBoxInfo> rowBoxList = new List <PBBoxInfo>();

            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                foreach (DataGridViewRow row in rows)
                {
                    PBBoxInfo box = row.Tag as PBBoxInfo;
                    if (box != null)
                    {
                        if (!rowBoxList.Exists(r => r.HU == box.HU))
                        {
                            rowBoxList.Add(box);
                        }
                    }
                }
            }
            if (rowBoxList.Count > 0)
            {
                if (MetroMessageBox.Show(this, "确认清除列表中箱记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    if (PackingBoxService.DeleteBoxByHu(rowBoxList.Select(i => i.HU).Distinct().ToList()))
                    {
                        MetroMessageBox.Show(this, "清除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;

                        currentBoxList.RemoveAll(i => rowBoxList.Exists(j => j.HU == i.HU));
                        updateGrid();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "清除失败,可能是网络不稳定,请稍候再试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }


            //清除提示
            //if (boxList != null && boxList.Count > 0)
            //{
            //    if (MetroMessageBox.Show(this, "确认清除列表中所有箱记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            //    {
            //        if (PackingBoxService.DeleteBoxByHu(boxList.Select(i => i.HU).Distinct().ToList()))
            //        {
            //            MetroMessageBox.Show(this, "清除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //            DialogResult = DialogResult.OK;
            //            Close();
            //        }
            //        else
            //        {
            //            MetroMessageBox.Show(this, "清除失败,可能是网络不稳定,请稍候再试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        }
            //    }
            //}
        }
示例#4
0
 private List <PBBoxDetailInfo> GetBoxDetailByHU(string hu)
 {
     if (currentBoxList.Exists(i => i.HU == hu))
     {
         return(currentBoxList.Find(i => i.HU == hu).Details);
     }
     else
     {
         return(PackingBoxService.GetBoxDetailsByHU(hu));
     }
 }
示例#5
0
        /// <summary>
        /// 取出队列中第一个上传任务,进行上传,上传完成后删除这条
        /// </summary>
        public void Upload()
        {
            lock (_lockObject)
            {
                if (isbusy)
                {
                    return;
                }
                else
                {
                    isbusy = true;
                }
                try
                {
                    if (CurrentUploadQueue.Count > 0)
                    {
                        // 取出任务上传
                        object o = CurrentUploadQueue.Pop();
                        if (o.GetType() == typeof(SqliteUploadDataInfo))
                        {
                            UploadBoxInfo box    = (o as SqliteUploadDataInfo).Data;
                            SapResult     result = new SapResult();
                            //if (box.Box.RESULT == "S")
                            //{
                            result = SAPDataService.UploadPackingBox(box.LGNUM, box.Box.HU, box.EQUIP_HLA, box.Box.RESULT, box.Box.MSG, box.Box.MX, box.LOUCENG, box.SUBUSER, box.Box.Details);

                            //(box.LGNUM, box.Box.HU, box.EQUIP_HLA, box.LOUCENG, box.SUBUSER, box.Box.Details);
                            box.Box.PACKMSG    = result.MSG;
                            box.Box.PACKRESULT = result.STATUS;
                            //if (!result.SUCCESS) box.Box.RESULT = "SE";
                            //if (!result.SUCCESS && OnUploadError != null) OnUploadError();
                            //}
                            if (result.STATUS == "E")
                            {
                                box.Box.Details.Clear();
                            }
                            bool xdSaveResult = PackingBoxService.SaveBox(box.Box);
                            SqliteDataService.DeleteUploaded((o as SqliteUploadDataInfo).Guid);
                            if (OnUploaded != null)
                            {
                                OnUploaded(box.Box);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
                }

                isbusy = false;
            }
        }
示例#6
0
        private void GenerateDocForm_Load(object sender, EventArgs e)
        {
            if (boxList == null || boxList.Count == 0)
            {
                boxList = PackingBoxService.GetNeedGenerateBoxListWithoutDetail();
            }
            if (boxList != null && boxList.Count > 0)
            {
                foreach (PBBoxInfo item in boxList)
                {
                    if (item.RESULT == "E")
                    {
                        continue;
                    }
                    if (item.PACKRESULT == "E")
                    {
                        //grid.Rows.Insert(0, item.Timestamps.ToString("yyyy-MM-dd"), item.LH, item.HU, item.PACKMSG);
                        //grid.Rows[0].DefaultCellStyle.BackColor = Color.OrangeRed;
                        errorBoxNum++;
                    }
                    else
                    {
                        rightBoxNum++;
                        grid.Rows.Add(item.Timestamps.ToString("yyyy-MM-dd"), item.LH, item.HU, item.PACKMSG);
                    }
                }

                if (errorBoxNum > 0)
                {
                    ShowStatusInfo(false, "有包装失败箱号,是否继续生成交接单?");
                }
                else
                {
                    ShowStatusInfo(true, "包装状态无异常,是否生成交接单?");
                }

                btnYes.Enabled = true;
                btnNo.Enabled  = true;
            }
            else
            {
                ShowStatusInfo(false, "当前没有需要生成交接单的箱记录");
                btnYes.Enabled = false;
                btnNo.Enabled  = true;
            }

            lblRight.Text = rightBoxNum.ToString();
            lblError.Text = errorBoxNum.ToString();
        }
示例#7
0
        private void returnTypeutton_Click(object sender, EventArgs e)
        {
            bool allChecked = returnTypeCheckBox.Checked;

            returnTypeutton.Enabled     = false;
            returnTypeProgressBar.Value = 0;

            new Thread(new ThreadStart(() =>
            {
                List <ReturnTypeInfo> rtInfo = SAPDataService.GetReturnTypeInfo(SysConfig.LGNUM, allChecked ? "X" : "");

                if (rtInfo != null)
                {
                    Invoke(new Action(() => { returnTypeProgressBar.Maximum = rtInfo.Count; }));

                    int failCount = 0;

                    foreach (ReturnTypeInfo ri in rtInfo)
                    {
                        Invoke(new Action(() => { returnTypeProgressBar.Value++; }));
                        if (!PackingBoxService.SaveReturnType(ri))
                        {
                            failCount++;
                        }
                    }

                    string log = string.Format("手工下载退货类型{0}条,失败{1}条", rtInfo.Count, failCount);
                    Invoke(new Action(() =>
                    {
                        returnTypeLabel.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + log;
                        returnTypeLabel.BackColor = failCount > 0 ? Color.Red : Color.White;
                    }));
                }
                else
                {
                    string log = string.Format("手工下载退货类型0条,失败0条");
                    Invoke(new Action(() =>
                    {
                        returnTypeLabel.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + log;
                        returnTypeLabel.BackColor = Color.White;
                    }));
                }

                Invoke(new Action(() => { returnTypeutton.Enabled = true; }));
            })).Start();
        }
示例#8
0
        private void DownloadReturnType()
        {
            this.Invoke(new Action(() =>
            {
                btnReturnType.Enabled = false;
                pbReturnType.Value    = 0;
            }));
            List <ReturnTypeInfo> list = SAPDataService.GetReturnTypeInfo(SysConfig.LGNUM, "");

            if (list != null)
            {
                int i = 0, total = list.Count;
                if (total > 0)
                {
                    foreach (ReturnTypeInfo item in list)
                    {
                        i++;
                        PackingBoxService.SaveReturnType(item);
                        this.Invoke(new Action(() =>
                        {
                            this.pbReturnType.Value = i * 100 / total;
                        }));
                    }
                }
                else
                {
                    this.Invoke(new Action(() =>
                    {
                        this.pbReturnType.Value = 100;
                    }));
                }
            }

            this.Invoke(new Action(() =>
            {
                this.btnReturnType.Enabled = true;
            }));
            ShowLog(string.Format("下载{0}条退货类型", list != null ? list.Count : 0));
        }
示例#9
0
        private void metroButton1_del_Click(object sender, EventArgs e)
        {
            try
            {
                if (metroTextBox1_hu.Text.Trim() == "")
                {
                    MessageBox.Show("请输入箱号");
                    return;
                }

                string        hu  = metroTextBox1_hu.Text.Trim();
                List <string> hus = new List <string>();
                hus.Add(hu);
                if (PackingBoxService.DeleteBoxByHu(hus))
                {
                    MessageBox.Show("操作成功");
                }
            }
            catch (Exception)
            {
            }
        }