예제 #1
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string code = ((LinkButton)sender).CommandArgument;

        try
        {
            TheBomMgr.DeleteBom(code);
            ShowSuccessMessage("MasterData.Bom.Delete.Successfully", code);
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("MasterData.Bom.Delete.Failed", code);
        }
    }
예제 #2
0
    private void UpdateView()
    {
        bom = TheBomMgr.LoadBom(this.code);
        Controls_TextBox tbUom    = (Controls_TextBox)(this.FV_Bom.FindControl("tbUom"));
        TextBox          tbRegion = (TextBox)(this.FV_Bom.FindControl("tbRegion"));

        if (bom.Uom != null)
        {
            tbUom.Text = bom.Uom.Code;
        }
        if (bom.Region != null)
        {
            tbRegion.Text = bom.Region.Code;
        }
    }
예제 #3
0
    public void ShowTreeView(object sender)
    {
        string   itemCode = ((object[])sender)[0].ToString();
        string   date     = ((object[])sender)[1].ToString();
        string   viewType = ((object[])sender)[2].ToString();
        DateTime effDate  = DateTime.Now;

        item = TheItemMgr.LoadItem(itemCode);
        if (item == null || item.Bom == null)
        {
            bom = TheBomMgr.LoadBom(itemCode);
        }
        else
        {
            bom = item.Bom;
        }
        if (bom == null)
        {
            ShowErrorMessage("MasterData.BomDetail.ErrorMessage.BomNotExist");
            this.fld.Visible = false;
            return;
        }
        else
        {
            this.fld.Visible = true;
        }
        try
        {
            effDate = Convert.ToDateTime(date);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.BomView.WarningMessage.DateInvalid");
            return;
        }

        bomDetailList = TheBomDetailMgr.GetTreeBomDetail(bom.Code, effDate);

        if (bomDetailList != null && bomDetailList.Count > 0)
        {
            MyOrgNode RootNode = new MyOrgNode();
            GenChildOrgNode(RootNode);
            OrgChartBomTreeView.Node = RootNode;
        }
    }
예제 #4
0
    protected void ODS_BomDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string parcode  = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim();
        string compcode = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim();
        string uom      = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim();
        string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim();

        com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_BomDetail.FindControl("ddlBackFlushMethod");

        bomdetail      = (BomDetail)e.InputParameters[0];
        bomdetail.Bom  = TheBomMgr.LoadBom(parcode);
        item           = TheItemMgr.LoadItem(compcode);
        bomdetail.Item = item;
        if (item != null)
        {
            //default compcode and uom
            if (uom.Trim() == "")
            {
                bomdetail.Uom = item.Uom;
            }
            else
            {
                bomdetail.Uom = TheUomMgr.LoadUom(uom);
            }
        }
        if (location == "")
        {
            bomdetail.Location = null;
        }
        else
        {
            bomdetail.Location = TheLocationMgr.LoadLocation(location);
        }
        if (ddlBackFlushMethod.SelectedIndex != -1)
        {
            bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue;
        }

        bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100;
        if (TheBomDetailMgr.CheckUniqueExist(bomdetail.Bom.Code, bomdetail.Item.Code, bomdetail.Operation, bomdetail.Reference, bomdetail.StartDate))
        {
            ShowWarningMessage("MasterData.BomDetail.WarningMessage.UniqueExistError");
            e.Cancel = true;
        }
    }
예제 #5
0
    protected void ODS_BomDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string parcode  = ((TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim();
        string compcode = ((TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim();
        string uom      = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim();
        string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim();
        string endTime  = ((TextBox)(this.FV_BomDetail.FindControl("tbEndTime"))).Text.Trim();

        com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList) this.FV_BomDetail.FindControl("ddlBackFlushMethod");

        bomdetail      = (BomDetail)e.InputParameters[0];
        bomdetail.Bom  = TheBomMgr.LoadBom(parcode);
        item           = TheItemMgr.LoadItem(compcode);
        bomdetail.Item = item;
        if (item != null)
        {
            //default compcode and uom
            if (uom.Trim() == string.Empty)
            {
                bomdetail.Uom = item.Uom;
            }
            else
            {
                bomdetail.Uom = TheUomMgr.LoadUom(uom);
            }
        }
        if (location == string.Empty)
        {
            bomdetail.Location = null;
        }
        else
        {
            bomdetail.Location = TheLocationMgr.LoadLocation(location);
        }
        if (ddlBackFlushMethod.SelectedIndex != -1)
        {
            bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue;
        }
        if (endTime != string.Empty)
        {
            bomdetail.EndDate = DateTime.Parse(endTime);
        }
        bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100;
    }
예제 #6
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvCode":
            if (TheBomMgr.LoadBom(args.Value) != null)
            {
                ShowWarningMessage("MasterData.Bom.WarningMessage.CodeExist", args.Value);
                args.IsValid = false;
            }
            if (TheItemMgr.LoadItem(args.Value) == null)
            {
                ShowWarningMessage("MasterData.Bom.WarningMessage.CodeItem", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvUom":
            if (TheUomMgr.LoadUom(args.Value) == null)
            {
                ShowWarningMessage("MasterData.Bom.WarningMessage.UomInvalid", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvRegion":
            if (args.Value.Trim() != "")
            {
                if (TheRegionMgr.LoadRegion(args.Value) == null)
                {
                    ShowWarningMessage("MasterData.Bom.WarningMessage.RegionInvalid", args.Value);
                    args.IsValid = false;
                }
            }
            break;

        default:
            break;
        }
    }
예제 #7
0
    protected void ODS_Item_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Item item = (Item)e.InputParameters[0];

        item.Desc1 = item.Desc1.Trim();
        item.Desc2 = item.Desc2.Trim();
        item.Memo  = item.Memo.Trim();

        item.Type = ((CodeMstrDropDownList)(this.FV_Item.FindControl("ddlType"))).SelectedValue;

        string uom = ((TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim();

        item.Uom = TheUomMgr.LoadUom(uom);

        string location = ((Controls_TextBox)(this.FV_Item.FindControl("tbLocation"))).Text.Trim();

        item.Location = TheLocationMgr.LoadLocation(location);

        string bom = ((Controls_TextBox)(this.FV_Item.FindControl("tbBom"))).Text.Trim();

        item.Bom = TheBomMgr.LoadBom(bom);

        string routing = ((Controls_TextBox)(this.FV_Item.FindControl("tbRouting"))).Text.Trim();

        item.Routing = TheRoutingMgr.LoadRouting(routing);

        string plant = ((CodeMstrDropDownList)(this.FV_Item.FindControl("ddlPlantType"))).Text.Trim();

        item.Plant = plant;

        decimal uc = item.UnitCount;

        uc = System.Decimal.Round(uc, 8);
        if (uc == 0)
        {
            ShowErrorMessage("MasterData.Item.UC.Zero");
            e.Cancel = true;
        }

        com.Sconit.Control.CodeMstrDropDownList ddlItemCategory = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Item.FindControl("ddlItemCategory"));
        if (ddlItemCategory.SelectedIndex != 0)
        {
            item.Category = ddlItemCategory.SelectedValue;
        }

        string imageUrl;
        string imgUpload = ((System.Web.UI.WebControls.Image)(this.FV_Item.FindControl("imgUpload"))).ImageUrl;

        if (((CheckBox)(this.FV_Item.FindControl("cbDeleteImage"))).Checked == true)
        {
            imageUrl = null;
            if (File.Exists(Server.MapPath(imgUpload)))
            {
                File.Delete(Server.MapPath(imgUpload));
            }
        }
        else
        {
            imageUrl = UploadItemImage(item.Code);
            if (imageUrl == null)
            {
                imageUrl = imgUpload;
            }
        }

        item.ImageUrl       = imageUrl;
        item.LastModifyDate = DateTime.Now;
        item.LastModifyUser = this.CurrentUser;
    }
예제 #8
0
    protected void ODS_FlowDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        FlowDetail flowDetail    = (FlowDetail)e.InputParameters[0];
        FlowDetail oldFLowDetail = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId);
        Flow       flow          = TheFlowMgr.LoadFlow(FlowCode, true);

        flowDetail.Flow           = flow;
        flowDetail.CreateDate     = oldFLowDetail.CreateDate;
        flowDetail.CreateUser     = oldFLowDetail.CreateUser;
        flowDetail.LastModifyDate = DateTime.Now;
        flowDetail.LastModifyUser = this.CurrentUser;
        flowDetail.Version        = oldFLowDetail.Version + 1;

        //seq
        if (flowDetail.Sequence == 0)
        {
            flowDetail.Sequence = TheFlowDetailMgr.LoadFlowDetail(this.FlowDetailId).Sequence;
        }
        Controls_TextBox tbItemCode = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbItemCode"));
        Controls_TextBox tbUom      = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbUom"));

        if (tbItemCode != null && tbItemCode.Text.Trim() != string.Empty)
        {
            flowDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text.Trim());
        }

        if (tbUom != null && tbUom.Text.Trim() != string.Empty)
        {
            flowDetail.Uom = TheUomMgr.LoadUom(tbUom.Text.Trim());
        }

        if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT ||
            this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS ||
            this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING)
        {
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProcurementLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }
            //djin 20120802 保存参考物料号
            Controls_TextBox tbRefItemCode = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbRefItemCode");
            if (tbRefItemCode != null && tbRefItemCode.Text.Trim() != string.Empty)
            {
                flowDetail.ReferenceItemCode = tbRefItemCode.Text.Trim();
            }
            //end
            if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT)
            {
                DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm");
                if (ddlBillSettleTerm.SelectedIndex != -1)
                {
                    if (ddlBillSettleTerm.SelectedValue == string.Empty)
                    {
                        flowDetail.BillSettleTerm = null;
                    }
                    else
                    {
                        flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue;
                    }
                }
                com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType");
                if (ddlBarCodeType.SelectedIndex != -1)
                {
                    flowDetail.BarCodeType = ddlBarCodeType.SelectedValue;
                }
            }
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION)
        {
            Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbDistributionLocFrom");
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
            DropDownList ddlBillSettleTerm = (DropDownList)this.FV_FlowDetail.FindControl("ddlBillSettleTerm");
            if (ddlBillSettleTerm.SelectedIndex != -1)
            {
                flowDetail.BillSettleTerm = ddlBillSettleTerm.SelectedValue;
            }

            DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption");
            if (ddlOddShipOption.SelectedIndex != -1)
            {
                flowDetail.OddShipOption = ddlOddShipOption.SelectedValue;
            }
            flowDetail.PackagingCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbPackagingCode")).Value;
            flowDetail.TransModeCode = ((System.Web.UI.HtmlControls.HtmlSelect) this.FV_FlowDetail.FindControl("tbTransModeCode")).Value;
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION)
        {
            Controls_TextBox tbBom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbBom");
            if (tbBom != null && tbBom.Text.Trim() != string.Empty)
            {
                flowDetail.Bom = TheBomMgr.LoadBom(tbBom.Text.Trim());
            }

            TextBox          tbBatchSize = (TextBox)this.FV_FlowDetail.FindControl("tbBatchSize");
            Controls_TextBox tbLocFrom   = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocFrom");
            if (tbBatchSize.Text.Trim() != string.Empty)
            {
                flowDetail.BatchSize = decimal.Parse(tbBatchSize.Text.Trim());
            }
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }
            Controls_TextBox tbCustomer = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbCustomer");
            if (tbCustomer != null && tbCustomer.Text.Trim() != string.Empty)
            {
                flowDetail.Customer = TheCustomerMgr.LoadCustomer(tbCustomer.Text.Trim());
            }
            com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowDetail.FindControl("ddlBarCodeType");
            if (ddlBarCodeType.SelectedIndex != -1)
            {
                flowDetail.BarCodeType = ddlBarCodeType.SelectedValue;
            }
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER)
        {
            Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocFrom");
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }

            DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption");
            if (ddlOddShipOption.SelectedIndex != -1)
            {
                flowDetail.OddShipOption = ddlOddShipOption.SelectedValue;
            }
        }
    }
예제 #9
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvParCode":
            if (TheBomMgr.LoadBom(args.Value) == null)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.ParCodeError", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvCompCode":
            if (TheItemMgr.LoadItem(args.Value) == null)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.CompCodeError", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvOp":
            try
            {
                Convert.ToInt32(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.OpError");
                args.IsValid = false;
            }
            break;

        case "cvUom":
            if (TheUomMgr.LoadUom(args.Value) == null)
            {
                ShowWarningMessage("MasterData.Bom.WarningMessage.UomInvalid", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvRateQty":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.RateQtyError");
                args.IsValid = false;
            }
            break;

        case "cvStruType":
            if (TheCodeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE, args.Value) == null)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.StruTypeError");
                args.IsValid = false;
            }
            break;

        case "cvScrapPercentage":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.ScrapPercentageError");
                args.IsValid = false;
            }
            break;

        case "cvStartTime":
            try
            {
                Convert.ToDateTime(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.StartTimeError");
                args.IsValid = false;
            }
            break;

        case "cvEndTime":
            try
            {
                if (args.Value.Trim() != "")
                {
                    Convert.ToDateTime(args.Value);
                }
            }
            catch (Exception)
            {
                ShowWarningMessage("MasterData.BomDetail.WarningMessage.EndTimeError");
                args.IsValid = false;
            }
            break;

        case "cvLocation":
            if (args.Value.Trim() != "")
            {
                if (TheLocationMgr.LoadLocation(args.Value) == null)
                {
                    ShowWarningMessage("MasterData.BomDetail.WarningMessage.LocationError", args.Value);
                    args.IsValid = false;
                }
            }
            break;

        default:
            break;
        }
    }
예제 #10
0
    protected void ODS_Item_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        item = (Item)e.InputParameters[0];

        item.Desc1 = item.Desc1.Trim();
        item.Desc2 = item.Desc2.Trim();
        item.Memo  = item.Memo.Trim();

        if (item.Code == null || item.Code.Trim() == string.Empty)
        {
            ShowErrorMessage("MasterData.Item.Code.Empty");
            e.Cancel = true;
            return;
        }
        else
        {
            item.Code = item.Code.Trim();
        }

        if (TheItemMgr.LoadItem(item.Code) != null)
        {
            e.Cancel = true;
            ShowErrorMessage("MasterData.Item.CodeExist", item.Code);
            return;
        }

        string uom = ((Controls_TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim() == string.Empty ? "EA"
            : ((Controls_TextBox)(this.FV_Item.FindControl("tbUom"))).Text.Trim();

        item.Uom = TheUomMgr.LoadUom(uom);

        string location = ((Controls_TextBox)(this.FV_Item.FindControl("tbLocation"))).Text.Trim();

        item.Location = TheLocationMgr.LoadLocation(location);

        string bom = ((Controls_TextBox)(this.FV_Item.FindControl("tbBom"))).Text.Trim();

        item.Bom = TheBomMgr.LoadBom(bom);

        string routing = ((Controls_TextBox)(this.FV_Item.FindControl("tbRouting"))).Text.Trim();

        item.Routing = TheRoutingMgr.LoadRouting(routing);

        decimal uc = item.UnitCount;

        uc = System.Decimal.Round(uc, 8);
        if (uc == 0)
        {
            ShowErrorMessage("MasterData.Item.UC.Zero");
            e.Cancel = true;
        }

        com.Sconit.Control.CodeMstrDropDownList ddlItemCategory = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Item.FindControl("ddlItemCategory"));
        if (ddlItemCategory.SelectedIndex != 0)
        {
            item.Category = ddlItemCategory.SelectedValue;
        }
        item.ImageUrl       = UploadItemImage(item.Code);
        item.LastModifyDate = DateTime.Now;
        item.LastModifyUser = this.CurrentUser;
    }