Exemplo n.º 1
0
        protected override object GetEditObject()
        {
            if (_orderFacade == null)
            {
                _orderFacade = new  FacadeFactory(base.DataProvider).CreateOrderFacade();
            }
            OrderDetail orderDetail = this._orderFacade.CreateNewOrderDetail();

            orderDetail.OrderNumber = this.txtOrderEdit.Text;
            orderDetail.PartnerCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPartnerCodeEdit.Text));
            orderDetail.ItemCode    = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemEdit.Text));

            ItemFacade itemfacade = new  FacadeFactory(base.DataProvider).CreateItemFacade();
            Object     item       = itemfacade.GetItem(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemEdit.Text)), GlobalVariables.CurrentOrganizations.First().OrganizationID);

            orderDetail.ItemName = (item as Item).ItemName;

            orderDetail.PlanDate     = FormatHelper.TODateInt(this.txtPlanDateEdit.Text);
            orderDetail.PlanQTY      = Convert.ToDecimal(this.txtPlanQTYEdit.Text);
            orderDetail.ActDate      = FormatHelper.TODateInt(this.txtActDateEdit.Text.Trim());
            orderDetail.ActQTY       = Convert.ToDecimal(this.txtActQTYEdit.Text.Trim());
            orderDetail.MaintainUser = this.GetUserCode();

            return(orderDetail);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="domainObject"></param>
        protected override void AddDomainObject(object domainObject)
        {
            ItemFacade itemFacade = new FacadeFactory(base.DataProvider).CreateItemFacade();
            object     obj        = itemFacade.GetItem(((CusItemCodeCheckList)domainObject).ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);

            if (obj == null)
            {
                WebInfoPublish.Publish(this, "$Error_ItemCode_NotCompare", this.languageComponent1);
                return;
            }

            ModelFacade modelFacade = new FacadeFactory(base.DataProvider).CreateModelFacade();

            object[] obj2 = modelFacade.GetModel2ItemByItemCode(((CusItemCodeCheckList)domainObject).ItemCode);
            if (obj2 == null)
            {
                WebInfoPublish.Publish(this, "$Error_ItemCode_NotMaintain_ModelCode", this.languageComponent1);
                return;
            }

            ((CusItemCodeCheckList)domainObject).ModelCode = ((Model2Item)obj2[0]).ModelCode;

            if (_facade == null)
            {
                _facade = new RMAFacade(base.DataProvider);
            }
            this._facade.AddCusItemCodeCheckList((CusItemCodeCheckList)domainObject);
        }
Exemplo n.º 3
0
 private void UpdateTestCondion(SPCItemSpec spcItemSpec, bool delete)
 {
     if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.PT_ELECTRIC, true) == 0)
     {
         ItemFacade facade = new FacadeFactory(base.DataProvider).CreateItemFacade();
         object     obj    = facade.GetItem(spcItemSpec.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
         if (obj != null)
         {
             (obj as Item).ElectricCurrentMaxValue = spcItemSpec.USL;
             (obj as Item).ElectricCurrentMinValue = spcItemSpec.LSL;
             (obj as Item).MaintainUser            = this.GetUserCode();
             facade.UpdateItem(obj as Item);
         }
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DUTY_RATO, true) == 0)
     {
         OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade();
         object    obj    = facade.GetOQCFuncTest(spcItemSpec.ItemCode);
         if (obj != null)
         {
             if (delete == false)
             {
                 (obj as OQCFuncTest).MinDutyRatoMax = spcItemSpec.USL;
                 (obj as OQCFuncTest).MinDutyRatoMin = spcItemSpec.LSL;
                 (obj as OQCFuncTest).MaintainUser   = this.GetUserCode();
                 facade.UpdateOQCFuncTest(obj as OQCFuncTest);
             }
             else
             {
                 (obj as OQCFuncTest).MinDutyRatoMax = 0;
                 (obj as OQCFuncTest).MinDutyRatoMin = 0;
                 (obj as OQCFuncTest).MaintainUser   = this.GetUserCode();
                 facade.UpdateOQCFuncTest(obj as OQCFuncTest);
             }
         }
         else if (delete == false)
         {
             obj = facade.CreateNewOQCFuncTest();
             (obj as OQCFuncTest).ItemCode       = spcItemSpec.ItemCode;
             (obj as OQCFuncTest).MinDutyRatoMax = spcItemSpec.USL;
             (obj as OQCFuncTest).MinDutyRatoMin = spcItemSpec.LSL;
             (obj as OQCFuncTest).MaintainUser   = this.GetUserCode();
             facade.AddOQCFuncTest(obj as OQCFuncTest);
         }
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_BURST_MD, true) == 0)
     {
         OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade();
         object    obj    = facade.GetOQCFuncTest(spcItemSpec.ItemCode);
         if (obj != null)
         {
             if (delete == false)
             {
                 (obj as OQCFuncTest).BurstMdFreMax = spcItemSpec.USL;
                 (obj as OQCFuncTest).BurstMdFreMin = spcItemSpec.LSL;
                 (obj as OQCFuncTest).MaintainUser  = this.GetUserCode();
                 facade.UpdateOQCFuncTest(obj as OQCFuncTest);
             }
             else
             {
                 (obj as OQCFuncTest).BurstMdFreMax = 0;
                 (obj as OQCFuncTest).BurstMdFreMin = 0;
                 (obj as OQCFuncTest).MaintainUser  = this.GetUserCode();
                 facade.UpdateOQCFuncTest(obj as OQCFuncTest);
             }
         }
         else if (delete == false)
         {
             obj = facade.CreateNewOQCFuncTest();
             (obj as OQCFuncTest).ItemCode      = spcItemSpec.ItemCode;
             (obj as OQCFuncTest).BurstMdFreMax = spcItemSpec.USL;
             (obj as OQCFuncTest).BurstMdFreMin = spcItemSpec.LSL;
             (obj as OQCFuncTest).MaintainUser  = this.GetUserCode();
             facade.AddOQCFuncTest(obj as OQCFuncTest);
         }
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_FT_FREQUENCY, true) == 0)
     {
         OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade();
         object    obj    = facade.GetOQCFuncTestSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq);
         if (obj != null)
         {
             if (delete == false)
             {
                 (obj as OQCFuncTestSpec).FreMax       = spcItemSpec.USL;
                 (obj as OQCFuncTestSpec).FreMin       = spcItemSpec.LSL;
                 (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode();
                 facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec);
             }
             else
             {
                 object objTmp = this._spcFacade.GetSPCItemSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq, SPCObjectList.OQC_FT_ELECTRIC);
                 if (objTmp == null)
                 {
                     facade.DeleteOQCFuncTestSpec(obj as OQCFuncTestSpec);
                 }
                 else
                 {
                     (obj as OQCFuncTestSpec).FreMax       = 0;
                     (obj as OQCFuncTestSpec).FreMin       = 0;
                     (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode();
                     facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec);
                 }
             }
         }
         else if (delete == false)
         {
             obj = facade.CreateNewOQCFuncTestSpec();
             (obj as OQCFuncTestSpec).ItemCode      = spcItemSpec.ItemCode;
             (obj as OQCFuncTestSpec).GroupSequence = spcItemSpec.GroupSeq;
             (obj as OQCFuncTestSpec).FreMax        = spcItemSpec.USL;
             (obj as OQCFuncTestSpec).FreMin        = spcItemSpec.LSL;
             (obj as OQCFuncTestSpec).MaintainUser  = this.GetUserCode();
             facade.AddOQCFuncTestSpec(obj as OQCFuncTestSpec);
         }
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_FT_ELECTRIC, true) == 0)
     {
         OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade();
         object    obj    = facade.GetOQCFuncTestSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq);
         if (obj != null)
         {
             if (delete == false)
             {
                 (obj as OQCFuncTestSpec).ElectricMax  = spcItemSpec.USL;
                 (obj as OQCFuncTestSpec).ElectricMin  = spcItemSpec.LSL;
                 (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode();
                 facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec);
             }
             else
             {
                 object objTmp = this._spcFacade.GetSPCItemSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq, SPCObjectList.OQC_FT_FREQUENCY);
                 if (objTmp == null)
                 {
                     facade.DeleteOQCFuncTestSpec(obj as OQCFuncTestSpec);
                 }
                 else
                 {
                     (obj as OQCFuncTestSpec).ElectricMax  = 0;
                     (obj as OQCFuncTestSpec).ElectricMin  = 0;
                     (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode();
                     facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec);
                 }
             }
         }
         else if (delete == false)
         {
             obj = facade.CreateNewOQCFuncTestSpec();
             (obj as OQCFuncTestSpec).ItemCode      = spcItemSpec.ItemCode;
             (obj as OQCFuncTestSpec).GroupSequence = spcItemSpec.GroupSeq;
             (obj as OQCFuncTestSpec).ElectricMax   = spcItemSpec.USL;
             (obj as OQCFuncTestSpec).ElectricMin   = spcItemSpec.LSL;
             (obj as OQCFuncTestSpec).MaintainUser  = this.GetUserCode();
             facade.AddOQCFuncTestSpec(obj as OQCFuncTestSpec);
         }
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LENGTH, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "LengthMax", "LengthMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_WIDTH, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "WidthMax", "WidthMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_BOARDHEIGHT, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "BoardHeightMax", "BoardHeightMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_HEIGHT, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "HeightMax", "HeightMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_ALLHEIGHT, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "AllHeightMax", "AllHeightMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LEFT2RIGHT, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "Left2RightMax", "Left2RightMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LEFT2MIDDLE, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "Left2MiddleMax", "Left2MiddleMin", delete);
     }
     else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_RIGHT2MIDDLE, true) == 0)
     {
         UpdateItem2Dimention(spcItemSpec, "Right2MiddleMax", "Right2MiddleMin", delete);
     }
 }