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

        try
        {
            TheRoutingDetailMgr.DeleteRoutingDetail(Convert.ToInt32(code));
            ShowSuccessMessage("Common.Business.Result.Delete.Successfully");
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("Common.Business.Result.Delete.Failed");
        }
    }
Esempio n. 2
0
    private void UpdateView()
    {
        Routingdetail = TheRoutingDetailMgr.LoadRoutingDetail(Convert.ToInt32(this.code));
        TextBox          tbCode       = (TextBox)(this.FV_RoutingDetail.FindControl("tbCode"));
        TextBox          tbRouting    = (TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"));
        TextBox          tbStartDate  = (TextBox)(this.FV_RoutingDetail.FindControl("tbStartDate"));
        TextBox          tbEndDate    = (TextBox)(this.FV_RoutingDetail.FindControl("tbEndDate"));
        TextBox          tbOperation  = (TextBox)(this.FV_RoutingDetail.FindControl("tbOperation"));
        TextBox          tbReference  = (TextBox)(this.FV_RoutingDetail.FindControl("tbReference"));
        Controls_TextBox tbWorkCenter = (Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbWorkCenter"));
        Controls_TextBox tbLocation   = (Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbLocation"));
        TextBox          tbSetupTime  = (TextBox)(this.FV_RoutingDetail.FindControl("tbSetupTime"));
        TextBox          tbRunTime    = (TextBox)(this.FV_RoutingDetail.FindControl("tbRunTime"));
        TextBox          tbMoveTime   = (TextBox)(this.FV_RoutingDetail.FindControl("tbMoveTime"));
        TextBox          tbTactTime   = (TextBox)(this.FV_RoutingDetail.FindControl("tbTactTime"));
        TextBox          tbActivity   = (TextBox)(this.FV_RoutingDetail.FindControl("tbActivity"));

        if (Routingdetail != null)
        {
            tbCode.Text      = Routingdetail.Id.ToString();
            tbRouting.Text   = Routingdetail.Routing.Code;
            tbStartDate.Text = Routingdetail.StartDate.ToString("yyyy-MM-dd");
            if (Routingdetail.EndDate != null)
            {
                tbEndDate.Text = ((DateTime)Routingdetail.EndDate).ToString("yyyy-MM-dd");
            }
            tbOperation.Text  = Routingdetail.Operation.ToString();
            tbReference.Text  = Routingdetail.Reference;
            tbWorkCenter.Text = Routingdetail.WorkCenter.Code;
            tbLocation.Text   = Routingdetail.Location == null ? string.Empty : Routingdetail.Location.Code;
            tbSetupTime.Text  = Routingdetail.SetupTime.ToString("0.########");
            tbRunTime.Text    = Routingdetail.RunTime.ToString("0.########");
            tbMoveTime.Text   = Routingdetail.MoveTime.ToString("0.########");
            tbTactTime.Text   = Routingdetail.TactTime.ToString("0.########");
            tbActivity.Text   = Routingdetail.Activity;
        }
    }
Esempio n. 3
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvSetupTime":
        case "cvMoveTime":
        case "cvRunTime":
        case "cvTactTime":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Validator.Valid.Number");
                args.IsValid = false;
            }
            break;

        case "cvStartDate":
            try
            {
                Convert.ToDateTime(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvEndDate":
            try
            {
                if (args.Value.Trim() != "")
                {
                    string startDate = ((TextBox)(this.FV_RoutingDetail.FindControl("tbStartDate"))).Text.Trim();
                    if (DateTime.Compare(Convert.ToDateTime(startDate), Convert.ToDateTime(args.Value.Trim())) >= 0)
                    {
                        ShowErrorMessage("Common.StarDate.EndDate.Compare");
                        args.IsValid = false;
                    }
                }
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        case "cvWorkCenter":
            if (args.Value.Trim() != "")
            {
                if (TheWorkCenterMgr.LoadWorkCenter(args.Value) == null)
                {
                    ShowWarningMessage("MasterData.WorkCenter.Code.NotExist", args.Value);
                    args.IsValid = false;
                }
            }
            break;

        case "cvOperation":
            string routingCode = ((TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"))).Text.Trim();
            string reference   = ((TextBox)(this.FV_RoutingDetail.FindControl("tbReference"))).Text.Trim();
            if (TheRoutingDetailMgr.LoadRoutingDetail(routingCode, Convert.ToInt32(args.Value.Trim()), reference) != null)
            {
                ShowWarningMessage("MasterData.RoutingDetail.UniqueExistError");
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }
Esempio n. 4
0
    public void InitPageParameter()
    {
        #region 已投料
        IList <ProductLineInProcessLocationDetail> productLineIpList = new List <ProductLineInProcessLocationDetail>();
        if (tbProductLine.Text.Trim() != string.Empty)
        {
            productLineIpList = TheProductLineInProcessLocationDetailMgr.GetProductLineInProcessLocationDetail(this.tbProductLine.Text.Trim(), BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE);
        }
        this.GV_List_Feeded.DataSource = productLineIpList;
        this.GV_List_Feeded.DataBind();
        #endregion

        #region 新投料
        //todo 根据flow得到Material的list
        IList <BomDetail>  bomDetailList  = new List <BomDetail>();
        IList <MaterialIn> materialInList = new List <MaterialIn>();
        if (this.tbProductLine.Text.Trim() != string.Empty)
        {
            bomDetailList = TheFlowMgr.GetBatchFeedBomDetail(this.tbProductLine.Text.Trim());
        }


        //暂时放在页面,后面再抽出来
        Flow flow = TheFlowMgr.LoadFlow(this.tbProductLine.Text.Trim(), true);
        if (bomDetailList != null && bomDetailList.Count > 0)
        {
            foreach (BomDetail bomDetail in bomDetailList)
            {
                MaterialIn materialIn = new MaterialIn();
                materialIn.Location    = bomDetail.Location;
                materialIn.Operation   = bomDetail.Operation;
                materialIn.RawMaterial = bomDetail.Item;

                //来源库位查找逻辑BomDetail-->RoutingDetail-->FlowDetail-->Flow
                Location bomLocFrom = bomDetail.Location;

                if (flow.Routing != null)
                {
                    //在Routing上查找,并检验Routing上的工序和BOM上的是否匹配
                    RoutingDetail routingDetail = TheRoutingDetailMgr.LoadRoutingDetail(flow.Routing, bomDetail.Operation, bomDetail.Reference);
                    if (routingDetail != null)
                    {
                        if (bomLocFrom == null)
                        {
                            bomLocFrom = routingDetail.Location;
                        }
                    }
                }

                if (bomLocFrom == null)
                {
                    bomLocFrom = bomDetail.DefaultLocation;
                }
                materialIn.Location = bomLocFrom;
                bool isInclude = false;
                foreach (MaterialIn m in materialInList)
                {
                    if (m.Location.Code == materialIn.Location.Code && m.Operation == materialIn.Operation && m.RawMaterial.Code == materialIn.RawMaterial.Code)
                    {
                        isInclude = true;
                    }
                }
                if (!isInclude)
                {
                    materialInList.Add(materialIn);
                }
            }
        }
        this.GV_List.DataSource = materialInList;
        this.GV_List.DataBind();
        #endregion
    }