Beispiel #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(this.OrderNo);

            if (cycleCount.IsScanHu)
            {
                cycleCount.Bins = this.ucStorageBinList.GetBins();
            }
            cycleCount.Items = this.ucItemList.GetItems();
            TheCycleCountMgr.UpdateCycleCount(cycleCount);
            this.Refresh();

            if (TabEvent != null)
            {
                TabEvent(new object[] { false, "" }, e);
            }

            ShowSuccessMessage("Common.Business.Result.Update.Successfully");
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage("Common.Business.Result.Update.Failed.Reason", ex.Message);
        }
    }
Beispiel #2
0
    private CycleCount GetCycleCount()
    {
        string region = this.tbRegion.Text.Trim();
        string location = this.tbLocation.Text.Trim();
        string effectiveDate = this.tbEffDate.Text.Trim();
        DateTime effDate = DateTime.Today;

        if (region == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.RegionInvalid");
            return null;
        }
        else if (location == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.LocationInvalid");
            return null;
        }

        try
        {
            effDate = Convert.ToDateTime(effectiveDate);
        }
        catch (Exception)
        {
            ShowErrorMessage("Common.Business.Error.DateInvalid");
            return null;
        }

        CycleCount cycleCount = new CycleCount();
        cycleCount.Location = TheLocationMgr.LoadLocation(location);
        cycleCount.EffectiveDate = effDate;
        cycleCount.Type = this.ddlType.SelectedValue;

        return cycleCount;
    }
Beispiel #3
0
    public void InitPageParameter(CycleCount cycleCount)
    {
        IList <CycleCountResult> cycleCountResultList = TheCycleCountMgr.CalcCycleCount(cycleCount.Code, true, true, true, null, null);

        this.GV_List.DataSource = cycleCountResultList;
        this.GV_List.DataBind();
    }
Beispiel #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(this.OrderNo);
            if (cycleCount.Type == BusinessConstants.CODE_MASTER_PHYCNT_TYPE_WHOLECHECK)
            {
                TheCycleCountMgr.ReleaseCycleCount(this.OrderNo, this.CurrentUser);
            }
            else
            {
                if (cycleCount.IsScanHu)
                {
                    cycleCount.Bins = this.ucStorageBinList.GetBins();
                }
                cycleCount.Items = this.ucItemList.GetItems();
                TheCycleCountMgr.ReleaseCycleCount(cycleCount, this.CurrentUser);
            }
            if (TabEvent != null)
            {
                TabEvent(new object[] { true, this.OrderNo }, e);
            }

            ShowSuccessMessage("Common.Business.Result.Submit.Successfully");
            this.InitPageParameter(this.OrderNo);
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #5
0
    protected void btnAdjust_Click(object sender, EventArgs e)
    {
        try
        {
            CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(Code);

            IList <int> cycleCountResultIdList = new List <int>();
            for (int i = 0; i < this.GV_List.Rows.Count; i++)
            {
                GridViewRow row           = this.GV_List.Rows[i];
                CheckBox    checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    if (cycleCount.IsScanHu)
                    {
                        Label lblStorageBin = (Label)row.FindControl("lblStorageBin");
                        Label lblItemCode   = (Label)row.FindControl("lblItemCode");

                        IList <string> binList  = new List <string>();
                        IList <string> itemList = new List <string>();
                        if (lblStorageBin.Text.Trim() != string.Empty)
                        {
                            binList.Add(lblStorageBin.Text.Trim());
                        }

                        if (lblItemCode.Text.Trim() != string.Empty)
                        {
                            itemList.Add(lblItemCode.Text.Trim());
                        }

                        IList <CycleCountResult> cycleCountResultList = TheCycleCountMgr.ListCycleCountResultDetail(this.Code, true, true, false, binList, itemList, binList.Count == 0);

                        foreach (CycleCountResult cycleCountResult in cycleCountResultList)
                        {
                            cycleCountResultIdList.Add(cycleCountResult.Id);
                        }
                    }
                    else
                    {
                        HiddenField hfId = (HiddenField)row.FindControl("hfId");
                        cycleCountResultIdList.Add(Int32.Parse(hfId.Value));
                    }
                }
            }
            if (cycleCountResultIdList.Count == 0)
            {
                ShowErrorMessage("Common.Message.Record.Not.Select");
                return;
            }
            TheCycleCountMgr.ProcessCycleCountResult(cycleCountResultIdList, this.CurrentUser);
            UpdateView();
            DoSearch();
            ShowSuccessMessage("Common.Business.Result.Adjust.Successfully");
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
        /// <summary>
        /// 审核盘点单
        /// </summary>
        /// <param name="danhao"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public static int PanDianShenHe(string danhao, int state)
        {
            StorageEntities ent = new StorageEntities();
            CycleCount      obj = ent.CycleCount.Find(danhao);

            obj.State = state;
            return(ent.SaveChanges());
        }
        /// <summary>
        /// 删除盘点单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int ShanChuPanDian(string id)
        {
            StorageEntities ent = new StorageEntities();
            CycleCount      obj = ent.CycleCount.Find(id);

            obj.dataState = false;
            return(ent.SaveChanges());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            CycleCount cycleCount = db.CycleCounts.Find(id);

            db.CycleCounts.Remove(cycleCount);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "CycleCountId,CycleCountDateTime,CustomerPn,SageQty,PortalQty,ActualQty,LocationsCounted,CountedBy,AuditedBy,CountOff,CorrectedBy,,SageAdjQty,PortalAdjQty,CorrectedDateTime,Notes")] CycleCount cycleCount)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cycleCount).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cycleCount));
 }
Beispiel #10
0
 public void InitPageParameter(CycleCount cycleCount)
 {
     this.tbOrderNo.Text        = cycleCount.Code;
     this.tbStatus.Text         = cycleCount.Status;
     this.tbRegion.Text         = StringHelper.GetCodeDescriptionString(cycleCount.Location.Region.Code, cycleCount.Location.Region.Name);
     this.tbLocation.Text       = StringHelper.GetCodeDescriptionString(cycleCount.Location.Code, cycleCount.Location.Name);
     this.tbEffDate.Text        = cycleCount.EffectiveDate.ToString("yyyy-MM-dd");
     this.ddlType.Value         = cycleCount.Type;
     this.tbLastModifyDate.Text = cycleCount.LastModifyDate.ToString("yyyy-MM-dd HH:mm");
     this.tbLastModifyUser.Text = StringHelper.GetCodeDescriptionString(cycleCount.LastModifyUser.Code, cycleCount.LastModifyUser.Name);
 }
Beispiel #11
0
 public void InitPageParameter(CycleCount cycleCount)
 {
     this.tbOrderNo.Text = cycleCount.Code;
     this.tbStatus.Text = cycleCount.Status;
     this.tbRegion.Text = StringHelper.GetCodeDescriptionString(cycleCount.Location.Region.Code, cycleCount.Location.Region.Name);
     this.tbLocation.Text = StringHelper.GetCodeDescriptionString(cycleCount.Location.Code, cycleCount.Location.Name);
     this.tbEffDate.Text = cycleCount.EffectiveDate.ToString("yyyy-MM-dd");
     this.ddlType.Value = cycleCount.Type;
     this.tbLastModifyDate.Text = cycleCount.LastModifyDate.ToString("yyyy-MM-dd HH:mm");
     this.tbLastModifyUser.Text = StringHelper.GetCodeDescriptionString(cycleCount.LastModifyUser.Code, cycleCount.LastModifyUser.Name);
 }
 public void CreateCycleCountDetail(CycleCount cycleCount, IList<CycleCountDetail> cycleCountDetailList)
 {
     if (cycleCountDetailList != null && cycleCountDetailList.Count > 0)
     {
         foreach (var item in cycleCountDetailList)
         {
             item.CycleCount = cycleCount;
             this.CreateCycleCountDetail(item);
         }
     }
 }
 public void CreateCycleCountDetail(CycleCount cycleCount, IList <CycleCountDetail> cycleCountDetailList)
 {
     if (cycleCountDetailList != null && cycleCountDetailList.Count > 0)
     {
         foreach (var item in cycleCountDetailList)
         {
             item.CycleCount = cycleCount;
             this.CreateCycleCountDetail(item);
         }
     }
 }
Beispiel #14
0
    public override void UpdateView()
    {
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(Code);

        this.Status = cycleCount.Status;
        if (cycleCount.IsScanHu)
        {
            tbBinCode.ServiceParameter = "string:" + cycleCount.Location.Code;
            tbBinCode.DataBind();
            tbBinCode.Visible                = true;
            lblBinCode.Visible               = true;
            btnExportDetail.Visible          = true;
            this.GV_List.Columns[6].Visible  = true;
            this.GV_List.Columns[7].Visible  = true;
            this.GV_List.Columns[8].Visible  = true;
            this.GV_List.Columns[9].Visible  = false;
            this.GV_List.Columns[10].Visible = false;
            this.GV_List.Columns[11].Visible = false;
        }
        else
        {
            this.GV_List.Columns[2].Visible  = false;
            this.GV_List.Columns[6].Visible  = false;
            this.GV_List.Columns[7].Visible  = false;
            this.GV_List.Columns[8].Visible  = false;
            this.GV_List.Columns[9].Visible  = true;
            this.GV_List.Columns[10].Visible = true;
            this.GV_List.Columns[11].Visible = true;
            tbBinCode.Visible       = false;
            lblBinCode.Visible      = false;
            btnExportDetail.Visible = false;
        }

        this.GV_List.Columns[0].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE;

        if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE)
        {
            this.btnAdjust.Visible = true;
            this.btnClose.Visible  = true;
            //this.GV_List.Columns[0].Visible = true;
        }
        else
        {
            this.btnAdjust.Visible = false;
            this.btnClose.Visible  = false;
            // this.GV_List.Columns[0].Visible = false;
        }

        this.isExport = false;
    }
Beispiel #15
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(this.OrderNo);
         IList <CycleCountDetail> cycleCountDetailList = TheImportMgr.ReadCycleCountFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, cycleCount);
         this.TheCycleCountMgr.RecordCycleCountDetail(this.OrderNo, cycleCountDetailList, this.CurrentUser);
         ShowSuccessMessage("Import.Result.Successfully");
     }
     catch (BusinessErrorException ex)
     {
         this.ShowErrorMessage(ex);
     }
 }
        // GET: CycleCounts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CycleCount cycleCount = db.CycleCounts.Find(id);

            if (cycleCount == null)
            {
                return(HttpNotFound());
            }
            return(View(cycleCount));
        }
Beispiel #17
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(this.OrderNo);

        IList <object>     cycleCountList  = new List <object>();
        IList <CycleCount> cycleCountListT = new List <CycleCount>();

        cycleCountListT.Add(cycleCount);
        cycleCountList.Add(cycleCountListT);
        cycleCountList.Add(CurrentUser.Code);
        string printUrl = TheReportMgr.WriteToFile("Stocktaking.xls", cycleCountList, "Stocktaking.xls");

        Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>");
    }
Beispiel #18
0
    public void InitPageParameter(CycleCount cycleCount)
    {
        this.ItemList = new List <Item>();

        if (cycleCount.Items != null && cycleCount.Items != string.Empty)
        {
            string[] itemArr = cycleCount.Items.Split('|');
            foreach (string item in itemArr)
            {
                Item oldItem = TheItemMgr.LoadItem(item);
                this.ItemList.Add(oldItem);
            }
        }
        this.GV_List.Columns[4].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
        BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
    }
Beispiel #19
0
    public void InitPageParameter(CycleCount cycleCount)
    {
        this.ItemList = new List<Item>();

        if (cycleCount.Items != null && cycleCount.Items != string.Empty)
        {
            string[] itemArr = cycleCount.Items.Split('|');
            foreach (string item in itemArr)
            {
                Item oldItem = TheItemMgr.LoadItem(item);
                this.ItemList.Add(oldItem);

            }
        }
        this.GV_List.Columns[4].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
        BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
    }
Beispiel #20
0
 public void InitPageParameter(string code, bool isEditMode)
 {
     try
     {
         InitialResolver(this.CurrentUser.Code, BusinessConstants.TRANSFORMER_MODULE_TYPE_STOCKTAKING);
         CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(code);
         this.CacheResolver.Code   = code;
         this.CacheResolver.Status = cycleCount.Status;
         IList <CycleCountDetail> cycleCountDetailList = TheCycleCountDetailMgr.GetCycleCountDetail(code);
         CacheResolver.Transformers = this.ConvertCycleCountToTransformer(cycleCountDetailList);
         this.EditMode = isEditMode;
         this.Refresh();
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Beispiel #21
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string   region        = this.tbRegion.Text.Trim();
        string   location      = this.tbLocation.Text.Trim();
        string   effectiveDate = this.tbEffDate.Text.Trim();
        DateTime effDate       = DateTime.Today;

        if (region == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.RegionInvalid");
            return;
        }
        else if (location == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.LocationInvalid");
            return;
        }

        try
        {
            effDate = Convert.ToDateTime(effectiveDate);
        }
        catch (Exception)
        {
            ShowErrorMessage("Common.Business.Error.DateInvalid");
            return;
        }

        CycleCount cycleCount = new CycleCount();

        cycleCount.Location      = TheLocationMgr.LoadLocation(location);
        cycleCount.EffectiveDate = effDate;
        cycleCount.Type          = this.ddlType.SelectedValue;
        cycleCount.IsScanHu      = this.cbIsScanHu.Checked;
        cycleCount.PhyCntGroupBy = this.ddlPhyCntGroupBy.SelectedValue;
        TheCycleCountMgr.CreateCycleCount(cycleCount, this.CurrentUser);
        ShowSuccessMessage("Common.Business.Result.Insert.Successfully");

        if (SaveEvent != null)
        {
            SaveEvent(cycleCount.Code, e);
        }
    }
Beispiel #22
0
    public void InitPageParameter(CycleCount cycleCount)
    {
        this.Location = cycleCount.Location.Code;

        this.StorageBinList = new List <StorageBin>();

        if (cycleCount.Bins != null && cycleCount.Bins != string.Empty)
        {
            string[] binArr = cycleCount.Bins.Split('|');
            foreach (string bin in binArr)
            {
                StorageBin storageBin = TheStorageBinMgr.LoadStorageBin(bin);
                storageBin.IsBlank = false;
                this.StorageBinList.Add(storageBin);
            }
        }
        this.GV_List.Columns[3].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
        BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
    }
Beispiel #23
0
    public void UpdateView()
    {
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(code);

        this.ucInfo.InitPageParameter(cycleCount);

        this.btnRecalc.Visible = (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT);
        this.btnAdjust.Visible = (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT);

        //if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)
        //{
        //    IList<CycleCountResult> cycleCountResultList = TheCycleCountMgr.ReCalcCycleCount(this.code, this.CurrentUser);
        //    this.BindData(cycleCountResultList);
        //}
        //else
        //{
        this.BindData();
        //}
    }
Beispiel #24
0
    public void ListEdit_Render(object sender, EventArgs e)
    {
        this.ucSearch.Visible   = false;
        this.ucList.Visible     = false;
        this.ucBusiness.Visible = true;
        string     code       = (string)sender;
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(code);

        if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL ||
            cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
        {
            TabEvent(new object[] { false, "" }, e);
        }
        else
        {
            TabEvent(new object[] { true, code }, e);
        }
        this.ucBusiness.InitPageParameter((string)sender);
    }
Beispiel #25
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string region = this.tbRegion.Text.Trim();
        string location = this.tbLocation.Text.Trim();
        string effectiveDate = this.tbEffDate.Text.Trim();
        DateTime effDate = DateTime.Today;

        if (region == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.RegionInvalid");
            return;
        }
        else if (location == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.LocationInvalid");
            return;
        }

        try
        {
            effDate = Convert.ToDateTime(effectiveDate);
        }
        catch (Exception)
        {
            ShowErrorMessage("Common.Business.Error.DateInvalid");
            return;
        }

        CycleCount cycleCount = new CycleCount();
        cycleCount.Location = TheLocationMgr.LoadLocation(location);
        cycleCount.EffectiveDate = effDate;
        cycleCount.Type = this.ddlType.SelectedValue;
        cycleCount.IsScanHu = this.cbIsScanHu.Checked;
        cycleCount.PhyCntGroupBy = this.ddlPhyCntGroupBy.SelectedValue;
        TheCycleCountMgr.CreateCycleCount(cycleCount, this.CurrentUser);
        ShowSuccessMessage("Common.Business.Result.Insert.Successfully");

        if (SaveEvent != null)
        {
            SaveEvent(cycleCount.Code, e);
        }
    }
    public void InitPageParameter(CycleCount cycleCount)
    {
        this.Location = cycleCount.Location.Code;

        this.StorageBinList = new List<StorageBin>();

        if (cycleCount.Bins != null && cycleCount.Bins != string.Empty)
        {
            string[] binArr = cycleCount.Bins.Split('|');
            foreach (string bin in binArr)
            {
                StorageBin storageBin = TheStorageBinMgr.LoadStorageBin(bin);
                storageBin.IsBlank = false;
                this.StorageBinList.Add(storageBin);

            }
        }
        this.GV_List.Columns[3].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
        BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
    }
Beispiel #27
0
    protected void btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            CycleCount cycleCount = this.GetCycleCount();
            if (cycleCount == null)
                return;

            IList<CycleCountDetail> cycleCountDetailList = TheImportMgr.ReadCycleCountFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, cycleCount);
            TheCycleCountMgr.SaveCycleCount(cycleCount, cycleCountDetailList, this.CurrentUser);
            ShowSuccessMessage("Import.Result.Successfully");
            if (BtnImportClick != null)
            {
                BtnImportClick(cycleCount.Code, null);
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #28
0
    public void InitPageParameter(string code)
    {
        this.OrderNo = code;
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(code);

        this.ucEdit.InitPageParameter(cycleCount);

        InitialUI();


        //全盘 不显示 库格明细和物料明细
        if (cycleCount.Type == BusinessConstants.CODE_MASTER_PHYCNT_TYPE_WHOLECHECK)
        {
            this.ucStorageBinList.Visible = false;
            this.ucItemList.Visible       = false;
            this.btnSave.Visible          = false;
        }
        else //抽盘
        {
            // 不选择 是否扫描条码 就没有库格明细
            if (!cycleCount.IsScanHu)
            {
                this.ucStorageBinList.Visible = false;
            }
            else
            {
                this.ucStorageBinList.InitPageParameter(cycleCount);
                this.ucStorageBinList.Visible = true;
            }

            this.ucItemList.InitPageParameter(cycleCount);
            ucItemList.Visible = true;
        }

        if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
        {
            //this.ucCycleCountResultList.InitPageParameter(cycleCount);
        }
    }
Beispiel #29
0
        private Plan CreateTypicalSDKPlan()
        {
            Plan plan = new Plan();

            plan.Contract    = PLAN_CONTRACT;
            plan.Group       = PLAN_GRP;
            plan.Original    = PLAN_ORI;
            plan.Description = PLAN_DES;
            plan.Data        = PLAN_DATA;
            plan.Cycle       = PLAN_CYC;
            plan.Id          = PLAN_ID;
            plan.Features    = PLAN_FEAT;
            plan.Name        = PLAN_NAME;
            CycleCount cycleCount = new CycleCount();

            cycleCount.Cycle = PLAN_CYC_CYCLE;
            cycleCount.Count = PLAN_CYC_COUNT;
            plan.FreeCycles  = cycleCount;
            Quota quota = new Quota();

            quota.Target = PLAN_QUOTA_TARGET;
            quota.Limit  = PLAN_QUOTA_LIMIT;
            quota.Cycle  = PLAN_QUOTA_CYCLE;
            quota.Scope  = PLAN_QUOTA_SCOPE;
            plan.AddQuota(quota);
            Price price1 = new Price();

            price1.Amount = PLAN_PRICE_AMOUNT;
            Currency currency1 = new Currency();

            currency1.Id    = PLAN_PRICE_CURR_ID;
            currency1.Name  = PLAN_PRICE_CURR_NAME;
            currency1.Data  = PLAN_PRICE_CURR_DATA;
            price1.Currency = currency1;
            plan.Price      = price1;

            return(plan);
        }
 public virtual void UpdateCycleCount(CycleCount entity)
 {
     entityDao.UpdateCycleCount(entity);
 }
 public virtual void CreateCycleCount(CycleCount entity)
 {
     entityDao.CreateCycleCount(entity);
 }
Beispiel #32
0
    public void InitPageParameter(string code)
    {
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(code);

        InitPageParameter(cycleCount);
    }
 public void InitPageParameter(CycleCount cycleCount)
 {
     IList<CycleCountResult> cycleCountResultList = TheCycleCountMgr.CalcCycleCount(cycleCount.Code, true, true, true , null, null);
     this.GV_List.DataSource = cycleCountResultList;
     this.GV_List.DataBind();
 }
Beispiel #34
0
        public IList<CycleCountDetail> ReadCycleCountFromXls(Stream inputStream, User user, CycleCount cycleCount)
        {
            if (inputStream.Length == 0)
                throw new BusinessErrorException("Import.Stream.Empty");

            //区域权限过滤
            if (!user.HasPermission(cycleCount.Location.Region.Code))
            {
                throw new BusinessErrorException("Common.Business.Error.NoPartyPermission", cycleCount.Location.Region.Code);
            }

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

            Sheet sheet = workbook.GetSheetAt(0);
            IEnumerator rows = sheet.GetRowEnumerator();

            ImportHelper.JumpRows(rows, 11);

            #region 列定义
            int colItem = 1;//物料代码
            int colUom = 3;//单位
            int colQty = 4;//数量
            int colHu = 5;//条码
            int colBin = 6;//库格
            #endregion

            IList<CycleCountDetail> cycleCountDetailList = new List<CycleCountDetail>();
            while (rows.MoveNext())
            {
                Row row = (HSSFRow)rows.Current;
                if (!this.CheckValidDataRow(row, 1, 7))
                {
                    break;//边界
                }

                if (row.GetCell(colHu) == null)
                {
                    string itemCode = string.Empty;
                    decimal qty = 0;
                    string uomCode = string.Empty;

                    #region 读取数据
                    #region 读取物料代码
                    itemCode = row.GetCell(colItem) != null ? row.GetCell(colItem).StringCellValue : string.Empty;
                    if (itemCode == null || itemCode.Trim() == string.Empty)
                        this.ThrowCommonError(row.RowNum, colItem, row.GetCell(colItem));

                    var i = (
                        from c in cycleCountDetailList
                        where c.HuId == null && c.Item.Code.Trim().ToUpper() == itemCode.Trim().ToUpper()
                        select c).Count();

                    if (i > 0)
                        throw new BusinessErrorException("Import.Business.Error.Duplicate", itemCode, (row.RowNum + 1).ToString(), (colItem + 1).ToString());
                    #endregion

                    #region 读取数量
                    try
                    {
                        qty = Convert.ToDecimal(row.GetCell(colQty).NumericCellValue);
                    }
                    catch
                    {
                        this.ThrowCommonError(row.RowNum, colQty, row.GetCell(colQty));
                    }
                    #endregion

                    #region 读取单位
                    uomCode = row.GetCell(colUom) != null ? row.GetCell(colUom).StringCellValue : string.Empty;
                    if (uomCode == null || uomCode.Trim() == string.Empty)
                        throw new BusinessErrorException("Import.Read.Error.Empty", (row.RowNum + 1).ToString(), colUom.ToString());
                    #endregion
                    #endregion

                    #region 填充数据
                    Item item = itemMgr.CheckAndLoadItem(itemCode);
                    Uom uom = uomMgr.CheckAndLoadUom(uomCode);
                    //单位换算
                    if (item.Uom.Code.Trim().ToUpper() != uom.Code.Trim().ToUpper())
                    {
                        qty = uomConversionMgr.ConvertUomQty(item, uom, qty, item.Uom);
                    }

                    CycleCountDetail cycleCountDetail = new CycleCountDetail();
                    cycleCountDetail.CycleCount = cycleCount;
                    cycleCountDetail.Item = item;
                    cycleCountDetail.Qty = qty; cycleCountDetailList.Add(cycleCountDetail);
                    #endregion
                }
                else
                {
                    string huId = string.Empty;
                    string binCode = string.Empty;

                    #region 读取数据
                    #region 读取条码
                    huId = row.GetCell(colHu) != null ? row.GetCell(colHu).StringCellValue : string.Empty;
                    if (huId == null || huId.Trim() == string.Empty)
                        throw new BusinessErrorException("Import.Read.Error.Empty", (row.RowNum + 1).ToString(), colHu.ToString());

                    var i = (
                        from c in cycleCountDetailList
                        where c.HuId != null && c.HuId.Trim().ToUpper() == huId.Trim().ToUpper()
                        select c).Count();

                    if (i > 0)
                        throw new BusinessErrorException("Import.Business.Error.Duplicate", huId, (row.RowNum + 1).ToString(), colHu.ToString());
                    #endregion

                    #region 读取库格
                    binCode = row.GetCell(colBin) != null ? row.GetCell(colBin).StringCellValue : null;
                    if (cycleCount.PhyCntGroupBy == BusinessConstants.CODE_MASTER_PHYCNT_GROUPBY_BIN
                        && (binCode == null || binCode == string.Empty))
                    {
                        throw new BusinessErrorException("Import.Read.Error.Empty", (row.RowNum + 1).ToString(), colBin.ToString());
                    }
                    #endregion
                    #endregion

                    #region 填充数据
                    Hu hu = huMgr.CheckAndLoadHu(huId);
                    StorageBin bin = null;
                    if (binCode != null && binCode.Trim() != string.Empty)
                    {
                        bin = storageBinMgr.CheckAndLoadStorageBin(binCode);
                    }

                    CycleCountDetail cycleCountDetail = new CycleCountDetail();
                    cycleCountDetail.CycleCount = cycleCount;
                    cycleCountDetail.Item = hu.Item;
                    cycleCountDetail.Qty = hu.Qty * hu.UnitQty;
                    cycleCountDetail.HuId = hu.HuId;
                    cycleCountDetail.LotNo = hu.LotNo;
                    cycleCountDetail.StorageBin = bin != null ? bin.Code : null;
                    cycleCountDetailList.Add(cycleCountDetail);
                    #endregion
                }
            }

            if (cycleCountDetailList.Count == 0)
                throw new BusinessErrorException("Import.Result.Error.ImportNothing");

            return cycleCountDetailList;
        }
 public virtual void Process(CycleCount c)
 {
     cycleCountMgr.ProcessCycleCountResult(c.Code, userMgr.GetMonitorUser());
 }
 public virtual void CreateCycleCount(CycleCount entity)
 {
     Create(entity);
 }
 public virtual void DeleteCycleCount(CycleCount entity)
 {
     entityDao.DeleteCycleCount(entity);
 }
 public virtual void UpdateCycleCount(CycleCount entity)
 {
     entityDao.UpdateCycleCount(entity);
 }
 public virtual void DeleteCycleCount(CycleCount entity)
 {
     entityDao.DeleteCycleCount(entity);
 }
 public virtual void CreateCycleCount(CycleCount entity)
 {
     entityDao.CreateCycleCount(entity);
 }
 public virtual void Process(CycleCount c)
 {
     cycleCountMgr.ProcessCycleCountResult(c.Code, userMgr.GetMonitorUser());
 }
Beispiel #42
0
    private void InitialUI()
    {
        CycleCount cycleCount = TheCycleCountMgr.LoadCycleCount(this.OrderNo);

        if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
        {
            this.btnSave.Visible     = true;
            this.btnDelete.Visible   = true;
            this.btnSubmit.Visible   = true;
            this.btnCancel.Visible   = false;
            this.btnComplete.Visible = false;
            this.btnPrint.Visible    = false;
            this.btnImport.Visible   = false;
            this.fileUpload.Visible  = false;
            this.hlTemplate.Visible  = false;
        }
        else if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)
        {
            this.btnSave.Visible     = false;
            this.btnDelete.Visible   = false;
            this.btnSubmit.Visible   = false;
            this.btnCancel.Visible   = true;
            this.btnComplete.Visible = true;
            this.btnPrint.Visible    = true;
            this.btnImport.Visible   = false;
            this.fileUpload.Visible  = false;
            this.hlTemplate.Visible  = false;
        }
        else if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
        {
            this.btnSave.Visible     = false;
            this.btnDelete.Visible   = false;
            this.btnSubmit.Visible   = false;
            this.btnCancel.Visible   = true;
            this.btnComplete.Visible = true;
            this.btnPrint.Visible    = true;
            this.btnImport.Visible   = true;
            this.fileUpload.Visible  = true;
            this.hlTemplate.Visible  = true;
        }
        else if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE)
        {
            this.btnSave.Visible     = false;
            this.btnDelete.Visible   = false;
            this.btnSubmit.Visible   = false;
            this.btnCancel.Visible   = false;
            this.btnComplete.Visible = false;
            this.btnPrint.Visible    = false;
            this.btnImport.Visible   = false;
            this.fileUpload.Visible  = false;
            this.hlTemplate.Visible  = false;
        }
        else if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE)
        {
            this.btnSave.Visible     = false;
            this.btnDelete.Visible   = false;
            this.btnSubmit.Visible   = false;
            this.btnCancel.Visible   = false;
            this.btnComplete.Visible = false;
            this.btnPrint.Visible    = false;
            this.btnImport.Visible   = false;
            this.fileUpload.Visible  = false;
            this.hlTemplate.Visible  = false;
        }
        else if (cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL)
        {
            this.btnSave.Visible     = false;
            this.btnDelete.Visible   = false;
            this.btnSubmit.Visible   = false;
            this.btnCancel.Visible   = false;
            this.btnComplete.Visible = false;
            this.btnPrint.Visible    = false;
            this.btnImport.Visible   = false;
            this.fileUpload.Visible  = false;
            this.hlTemplate.Visible  = false;
        }
    }
 public void InitPageParameter(CycleCount cycleCount)
 {
     IList<CycleCountResult> cycleCountResultList = TheCycleCountMgr.CalcCycleCount(cycleCount.Code, BusinessConstants.CODE_MASTER_PHYCNT_GROUPBY_BIN, true, true, true , null, null);
     this.GV_List.DataSource = cycleCountResultList;
     this.GV_List.DataBind();
 }
 public virtual void DeleteCycleCount(CycleCount entity)
 {
     Delete(entity);
 }
 public virtual void UpdateCycleCount(CycleCount entity)
 {
     Update(entity);
 }