Пример #1
0
 protected override void gridWebGrid_ItemCommand(GridRecord row, string commandName)
 {
     if (commandName == "LinkToCartonImport")
     {
         string CheckNo     = row.Items.FindItemByKey("CheckNo").Text.Trim();
         string StorageCode = row.Items.FindItemByKey("StorageCode").Text.Trim();
         BenQGuru.eMES.Domain.Warehouse.StockCheck ssss = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(CheckNo);
         if (ssss.CheckType == "All")
         {
             Response.Redirect(this.MakeRedirectUrl("FStockCheckDetails.aspx", new string[] { "CheckNo", "StorageCode" }, new string[] { CheckNo, StorageCode }));
         }
         else if (ssss.CheckType == "Portion")
         {
             Response.Redirect(this.MakeRedirectUrl("FStockPortionCheckDetails.aspx", new string[] { "CheckNo", "StorageCode" }, new string[] { CheckNo, StorageCode }));
         }
     }
     else if (commandName == "StockCheckOp")
     {
         string checkNo = row.Items.FindItemByKey("CheckNo").Text.Trim();
         BenQGuru.eMES.Domain.Warehouse.StockCheck ssss = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(checkNo);
         if (ssss.CheckType == "Portion")
         {
             Response.Redirect(this.MakeRedirectUrl("FPortionStockCheckOp.aspx",
                                                    new string[] { "CheckCode" },
                                                    new string[] { checkNo }));
         }
         else
         {
             WebInfoPublish.Publish(this, "盘点类型必须是动盘!", this.languageComponent1);
         }
     }
 }
Пример #2
0
        protected void cmdStorageCheckClose_ServerClick(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            BenQGuru.eMES.Material.StockCheckDetailOp[] ops = this._WarehouseFacade.GetPortionStockCheckOpsNoPager(txtStockCheckCodeQuery.Text);

            foreach (BenQGuru.eMES.Material.StockCheckDetailOp op in ops)
            {
                if (op.STORAGEQTY != op.Qty)
                {
                    if (string.IsNullOrEmpty(op.DiffDesc))
                    {
                        WebInfoPublish.Publish(this, "存在数量不一致请填写盘点差异原因!", this.languageComponent1); return;
                    }
                }
            }
            BenQGuru.eMES.Domain.Warehouse.StockCheck s = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(txtStockCheckCodeQuery.Text);
            s.STATUS = "Close";
            _WarehouseFacade.UpdateStockCheck(s);
            WebInfoPublish.Publish(this, "盘点关闭成功!", this.languageComponent1); return;

            this.txtStockCheckCodeEdit.Text = string.Empty;
            txtDQMCODEEdit.Text             = string.Empty;
            txtStorageCodeEdit.Text         = string.Empty;
            txtLocationCodeEdit.Text        = string.Empty;
            txtLocationCodeEdit.Text        = string.Empty;
            txtCARTONNOEdit.Text            = string.Empty;
            txtCheckQtyEdit.Text            = string.Empty;
            txtDiffDescEdit.Text            = string.Empty;
        }
Пример #3
0
        protected override string[] FormatExportRecord(object obj)
        {
            BenQGuru.eMES.Domain.Warehouse.StockCheck s = ((BenQGuru.eMES.Domain.Warehouse.StockCheck)obj);
            return(new string[] {
                s.CheckNo,
                s.StorageCode,
                FormatHelper.ToDateString(s.CDATE),
                s.STATUS,
                s.CUSER,
                FormatHelper.ToDateString(s.CDATE),
                FormatHelper.ToTimeString(s.CTIME),


                s.REMARK1
            });
        }
Пример #4
0
        protected void cmdStorageCheckClose_ServerClick(object sender, EventArgs e)
        {
            if (!HasAuthority())
            {
                WebInfoPublish.Publish(this, "没有权限操作!", this.languageComponent1); return;
            }

            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }

            BenQGuru.eMES.Domain.Warehouse.StockCheck s = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(txtStockCheckCodeQuery.Text);
            s.STATUS = "Close";
            _WarehouseFacade.UpdateStockCheck(s);
            WebInfoPublish.Publish(this, "盘点关闭成功!", this.languageComponent1); return;
        }
Пример #5
0
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            BenQGuru.eMES.Domain.Warehouse.StockCheck p = (BenQGuru.eMES.Domain.Warehouse.StockCheck)obj;
            row["CheckNo"]     = p.CheckNo;
            row["CheckType"]   = languageComponent1.GetString("STOCK" + p.CheckType);
            row["StorageCode"] = p.StorageCode;
            row["CDATE"]       = FormatHelper.ToDateString(p.CDATE);
            row["Status"]      = p.STATUS;
            row["CUSER"]       = p.CUSER;
            row["CDATE"]       = FormatHelper.ToDateString(p.CDATE);
            row["CTIME"]       = FormatHelper.ToTimeString(p.CTIME);
            row["REMARK1"]     = p.REMARK1;

            return(row);
        }
Пример #6
0
        protected void cmdLotSave_ServerClick(object sender, EventArgs e)
        {
            try
            {
                WarehouseFacade _WarehouseFacade = new WarehouseFacade(base.DataProvider);
                BenQGuru.eMES.Domain.Warehouse.StockCheck ssss = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(txtStockCheckCodeQuery.Text);
                if (ssss == null)
                {
                    WebInfoPublish.Publish(this, "只有盘点单不存在!", this.languageComponent1); return;
                }
                this.DataProvider.BeginTransaction();

                for (int i = 0; i < this.gridWebGrid.Rows.Count; i++)
                {
                    string storageCode = this.gridWebGrid.Rows[i].Items.FindItemByKey("StorageCode").Value.ToString();
                    string dqmcode     = this.gridWebGrid.Rows[i].Items.FindItemByKey("DQMCODE").Value.ToString();
                    string newDiffDesc = this.gridWebGrid.Rows[i].Items.FindItemByKey("DiffDesc").Value.ToString();

                    string oldDiffDesc = this.gridWebGrid.Rows[i].Items.FindItemByKey("OldDiffDesc").Value.ToString();
                    if (newDiffDesc != oldDiffDesc)
                    {
                        _WarehouseFacade.UpdateStockCheckDetail(txtStockCheckCodeQuery.Text, dqmcode, storageCode, newDiffDesc);
                    }
                }

                this.DataProvider.CommitTransaction();


                WebInfoPublish.Publish(this, "保存完成!", this.languageComponent1);
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
        }
Пример #7
0
        protected void cmdAdd_ServerClick(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            if (string.IsNullOrEmpty(txtStockCheckEdit.Text))
            {
                WebInfoPublish.Publish(this, "盘点单号不能为空!", this.languageComponent1); return;
            }
            if (string.IsNullOrEmpty(drpStorageCodeEdit.SelectedValue))
            {
                WebInfoPublish.Publish(this, "库位不能为空!", this.languageComponent1); return;
            }
            if (string.IsNullOrEmpty(drpCheckTypeEdit.SelectedValue))
            {
                WebInfoPublish.Publish(this, "盘点类型不能为空!", this.languageComponent1); return;
            }
            if (drpCheckTypeEdit.SelectedValue != "Portion")
            {
                if (!string.IsNullOrEmpty(txtBDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "盘点日期动盘时才可用!", this.languageComponent1); return;
                }
                if (!string.IsNullOrEmpty(txtEDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "盘点日期动盘时才可用!", this.languageComponent1); return;
                }
            }
            if (drpCheckTypeEdit.SelectedValue == "Portion")
            {
                if (string.IsNullOrEmpty(txtBDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "必须输入盘点日期!", this.languageComponent1); return;
                }
                if (string.IsNullOrEmpty(txtEDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "必须输入盘点日期!", this.languageComponent1); return;
                }
            }

            try
            {
                this.DataProvider.BeginTransaction();
                BenQGuru.eMES.Domain.Warehouse.StockCheck s = new BenQGuru.eMES.Domain.Warehouse.StockCheck();
                s.CheckNo     = txtStockCheckEdit.Text;
                s.CheckType   = drpCheckTypeEdit.SelectedValue;
                s.StorageCode = drpStorageCodeEdit.Text;
                s.REMARK1     = txtREMARKEdit.Text;
                s.STATUS      = "WaitCheck";
                s.FACCODE     = " ";
                s.SDATE       = FormatHelper.TODateInt(txtBDateEdit.Text);
                s.EDATE       = FormatHelper.TODateInt(txtEDateEdit.Text);
                s.MDATE       = FormatHelper.TODateInt(DateTime.Now);
                s.MTIME       = FormatHelper.TOTimeInt(DateTime.Now);
                s.MUSER       = GetUserCode();
                s.CDATE       = FormatHelper.TODateInt(DateTime.Now);
                s.CTIME       = FormatHelper.TOTimeInt(DateTime.Now);
                s.CUSER       = GetUserCode();
                _WarehouseFacade.AddStockCheck(s);

                BenQGuru.eMES.Material.Do[] ds;
                bool isPortion = false;
                if (drpCheckTypeEdit.SelectedValue == "Portion")
                {
                    ds        = _WarehouseFacade.GetPortionStorageQty(drpStorageCodeEdit.Text, s.SDATE, s.EDATE);
                    isPortion = true;
                }
                else
                {
                    ds = _WarehouseFacade.GetStorageQTY123(drpStorageCodeEdit.Text);
                }
                foreach (BenQGuru.eMES.Material.Do d in ds)
                {
                    BenQGuru.eMES.Domain.Warehouse.StockCheckDetail ss = new BenQGuru.eMES.Domain.Warehouse.StockCheckDetail();
                    ss.CheckNo     = txtStockCheckEdit.Text;
                    ss.StorageCode = drpStorageCodeEdit.SelectedValue;
                    ss.DQMCODE     = d.DQMCODE;

                    BenQGuru.eMES.Domain.MOModel.Material m = _WarehouseFacade.GetMaterialFromDQMCode(d.DQMCODE);
                    if (m == null)
                    {
                        throw new Exception(d.DQMCODE + "物料在物料表中不存在!");
                    }
                    ss.MDESC = m.MchshortDesc;
                    ss.UNIT  = m.Muom;

                    ss.STORAGEQTY   = d.sum;
                    ss.LocationCode = " ";
                    ss.CARTONNO     = string.IsNullOrEmpty(d.CARTONNO) ? " " : d.CARTONNO;
                    if (isPortion)
                    {
                        ss.LocationCode = d.LOCATIONCODE;
                        //StorageDetail storageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(ss.CARTONNO);
                        //if (storageDetail != null)
                        //{
                        //    ss.LocationCode = storageDetail.LocationCode;
                        //}
                    }
                    ss.MDATE = FormatHelper.TODateInt(DateTime.Now);
                    ss.MTIME = FormatHelper.TOTimeInt(DateTime.Now);
                    ss.MUSER = GetUserCode();
                    ss.CDATE = FormatHelper.TODateInt(DateTime.Now);
                    ss.CTIME = FormatHelper.TOTimeInt(DateTime.Now);
                    ss.CUSER = GetUserCode();
                    _WarehouseFacade.AddStockCheckDetails(ss);
                }
                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }



            WebInfoPublish.Publish(this, "添加成功!", this.languageComponent1); return;
        }
Пример #8
0
        protected void cmdLoadCheckResult_click(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array == null)
            {
                return;
            }

            if (array.Count != 1)
            {
                WebInfoPublish.Publish(this, "只能选择一行!", this.languageComponent1); return;
            }
            string time = DateTime.Now.ToString("yyyyMMdd_HHmmss");//")+ ""+DateTime.Now.ToString("



            XlsPackage xls      = new XlsPackage();
            string     filename = string.Format("Export_{0}_{1}.{2}", FormatHelper.TODateInt(System.DateTime.Now).ToString(), FormatHelper.TOTimeInt(System.DateTime.Now).ToString(), "xls");
            string     filepath = string.Format(@"{0}{1}", this.DownloadPhysicalPath, filename);
            int        n        = 1;

            foreach (GridRecord row1 in array)
            {
                string checkNo = row1.Items.FindItemByKey("CheckNo").Text;
                xls.CreateSheet("sheet" + n);
                xls.NewRow(0);
                xls.Cell(0, "盘点单号:", xls.Normal);
                xls.Cell(1, checkNo, xls.Normal);

                xls.NewRow(1);
                xls.Cell(0, "库位", xls.Normal);
                xls.Cell(1, "鼎桥物料编码", xls.Normal);
                xls.Cell(2, "盘点数量", xls.Normal);
                BenQGuru.eMES.Domain.Warehouse.StockCheck ssss = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(checkNo);

                if (ssss.CheckType != "All")
                {
                    WebInfoPublish.Publish(this, "必须是全盘才可用!", this.languageComponent1); return;
                }
                int i = 1;
                BenQGuru.eMES.Domain.Warehouse.StockCheckDetail[] sdddd = _WarehouseFacade.GetDisStockCheckDetails(checkNo);
                foreach (BenQGuru.eMES.Domain.Warehouse.StockCheckDetail d in sdddd)
                {
                    xls.NewRow(1 + i);
                    xls.Cell(0, d.StorageCode, xls.Normal);
                    xls.Cell(1, d.DQMCODE, xls.Normal);
                    xls.Cell(2, d.CheckQty.ToString(), xls.Normal);
                    i++;
                }

                n++;
            }

            System.IO.FileStream file = new System.IO.FileStream(filepath, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
            xls.Save(file);
            file.Close();
            DownLoadFile1(filename);
        }
Пример #9
0
        //导入按钮
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array == null)
            {
                return;
            }

            if (array.Count != 1)
            {
                WebInfoPublish.Publish(this, "只能选择一行!", this.languageComponent1); return;
            }
            try
            {
                GridRecord row1    = (GridRecord)array[0];
                string     checkNo = row1.Items.FindItemByKey("CheckNo").Text;

                BenQGuru.eMES.Domain.Warehouse.StockCheck ssss = (BenQGuru.eMES.Domain.Warehouse.StockCheck)_WarehouseFacade.GetStockCheck(checkNo);
                if (ssss == null)
                {
                    WebInfoPublish.Publish(this, "只有盘点单不存在!", this.languageComponent1); return;
                }
                if (ssss.CheckType != "All")
                {
                    WebInfoPublish.Publish(this, "只有盘点类型为全盘时可用!", this.languageComponent1); return;
                }
                if (ssss.STATUS == "Close")
                {
                    WebInfoPublish.Publish(this, "盘点单已经关闭!", this.languageComponent1); return;
                }


                System.IO.Stream ss       = FileUpload1.PostedFile.InputStream;
                string           fileName = FileUpload1.PostedFile.FileName;
                IWorkbook        workbook = null;



                if (string.IsNullOrEmpty(fileName) || System.IO.Path.GetExtension(fileName).ToLower() != ".xls") // 2007版本
                {
                    WebInfoPublish.Publish(this, "必须是.xls文件!", this.languageComponent1); return;
                }

                try
                {
                    workbook = new HSSFWorkbook(ss);
                }
                catch (Exception ex)
                {
                    WebInfoPublish.Publish(this, "未处理的异常!" + ex.Message, this.languageComponent1); return;
                }
                ISheet sheet = workbook.GetSheetAt(0);
                if (sheet == null)
                {
                    WebInfoPublish.Publish(this, "Excel文件为空!", this.languageComponent1); return;
                }
                IRow row = null;
                row = sheet.GetRow(0);
                ICell  cellFirst   = row.GetCell(1);
                string cellCheckNo = cellFirst.ToString();
                if (string.IsNullOrEmpty(cellCheckNo) || cellCheckNo != checkNo)
                {
                    WebInfoPublish.Publish(this, "xls文件中的盘点单号必须与所选的盘点单号一致!", this.languageComponent1); return;
                }



                int           rowNum     = 2;
                int           lastRowNum = sheet.LastRowNum;
                List <string> list       = new List <string>();
                for (row = sheet.GetRow(2); rowNum <= lastRowNum; rowNum++, row = sheet.GetRow(rowNum))
                {
                    ICell  cell2   = row.GetCell(1);
                    string dqmCode = cell2.StringCellValue.Trim();

                    if (string.IsNullOrEmpty(dqmCode))
                    {
                        WebInfoPublish.Publish(this, "xls文件中的鼎桥物料编号不能为空!", this.languageComponent1); return;
                    }
                    if (list.Contains(dqmCode))
                    {
                        WebInfoPublish.Publish(this, "xls文件中的鼎桥物料编号" + dqmCode + "不能重复!", this.languageComponent1); return;
                    }
                    list.Add(dqmCode);
                }

                rowNum     = 2;
                lastRowNum = sheet.LastRowNum;

                this.DataProvider.BeginTransaction();

                int date = FormatHelper.TODateInt(DateTime.Now);
                int time = FormatHelper.TOTimeInt(DateTime.Now);
                for (row = sheet.GetRow(2); rowNum <= lastRowNum; rowNum++, row = sheet.GetRow(rowNum))
                {
                    ICell cell1 = row.GetCell(0);
                    ICell cell2 = row.GetCell(1);
                    ICell cell3 = row.GetCell(2);
                    if (cell1 != null && cell2 != null && cell3 != null)
                    {
                        string  storageCode = cell1.StringCellValue;
                        string  dqmCode     = cell2.StringCellValue;
                        decimal checkQty    = 0;
                        decimal.TryParse(cell3.ToString(), out checkQty);



                        _WarehouseFacade.UpdateStockCheckDetailIfTypeIsCheckALL(checkNo, dqmCode, (int)checkQty, date, time);
                    }
                }
                this.DataProvider.CommitTransaction();
                WebInfoPublish.Publish(this, "导入成功!", this.languageComponent1); return;
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                WebInfoPublish.Publish(this, "未处理的异常!" + ex.Message, this.languageComponent1); return;
            }
        }