Exemplo n.º 1
0
        private void btnUpdateExcel_Click(object sender, EventArgs e)
        {
            var dialog = this.ofdKcExcel.ShowDialog();

            if (dialog == DialogResult.OK)
            {
                var bytes = File.ReadAllBytes(this.ofdKcExcel.FileName);
                KuCunFilePath = ofdKcExcel.FileName;

                using (var ms = new MemoryStream(bytes))
                {
                    var result = ExcelHelper.ReadKuCunInfosExcel(ms);
                    FillDataInfos(result, this.dgvKuCunInfo);

                    this.KuCunInfoList = KuCunInfo.MapCunInfos(result);
                }

                using (var ms = new MemoryStream(bytes))
                {
                    var result = ExcelHelper.ReadFaHuoInfosExcel(ms);
                    var data   = FaHuoTaskItemView.MapTaskItems(result);
                    FillDataInfos(data, this.dgvFaHuoTaskInfo);

                    FaHuoTaskItemList = FaHuoTaskItem.MapTaskItems(result);
                }
            }
            CheckExecResult();
        }
Exemplo n.º 2
0
        private static List <KuCunInfo> InitKuCunInfos()
        {
            var baseKuCunInfo = new KuCunInfo()
            {
                XingHao = "A",
                LunHao  = 40,
                PaiHao  = 30,
                Length  = 200,
            };

            var kuCunInfo = new List <KuCunInfo>()
            {
                new KuCunInfo()
                {
                    XingHao = baseKuCunInfo.XingHao,
                    LunHao  = baseKuCunInfo.LunHao + 1,
                    PaiHao  = baseKuCunInfo.PaiHao + 1,
                    Length  = 200,
                    IsWheel = "否"
                },
                new KuCunInfo()
                {
                    XingHao = baseKuCunInfo.XingHao,
                    LunHao  = baseKuCunInfo.LunHao + 1,
                    PaiHao  = baseKuCunInfo.PaiHao + 1,
                    Length  = 300,
                    IsWheel = "否"
                },
                new KuCunInfo()
                {
                    XingHao = baseKuCunInfo.XingHao,
                    LunHao  = baseKuCunInfo.LunHao + 1,
                    PaiHao  = baseKuCunInfo.PaiHao + 1,
                    Length  = 600,
                    IsWheel = "否"
                },
                new KuCunInfo()
                {
                    XingHao = baseKuCunInfo.XingHao,
                    LunHao  = baseKuCunInfo.LunHao + 1,
                    PaiHao  = baseKuCunInfo.PaiHao + 1,
                    Length  = 1000,
                    IsWheel = "是"
                },
            };

            return(kuCunInfo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 上传库存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnKcInfo_Click(object sender, EventArgs e)
        {
            var dialog = this.ofdKcExcel.ShowDialog();

            if (dialog == DialogResult.OK)
            {
                var bytes = File.ReadAllBytes(this.ofdKcExcel.FileName);
                KuCunFilePath = ofdKcExcel.FileName;

                using (var ms = new MemoryStream(bytes))
                {
                    var result = ExcelHelper.ReadKuCunInfosExcel(ms);
                    FillDataInfos(result, this.dgvKuCunInfo);

                    this.KuCunInfoList = KuCunInfo.MapCunInfos(result);
                }
            }
            await CheckExecResult();
        }