【问题标题】:Add a Stock Item Attribute to the Sales Order Line Grid Acumatica将库存项目属性添加到销售订单行网格 Acumatica
【发布时间】:2021-12-11 18:56:40
【问题描述】:

I have a stock items attribute added called ACCITEMS which is a multi select combo box and I have to pull those values to the respective sales order line when inventory id is selected, at the moment only 1 attribute value displays instead of multiple selected属性。

        [PXDBString(250, IsUnicode = true)]
        [PXUIField(DisplayName = "Accessories Items")]
        public virtual string UsrAccessoriesFrmStkItems { get; set; }
        public abstract class usrAccessoriesFrmStkItems : PX.Data.BQL.BqlString.Field<usrAccessoriesFrmStkItems> { }
        #endregion ```

    ```protected virtual void SOLine_InventoryID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
        {
            InvokeBaseHandler?.Invoke(sender, e);
            SOLine row = (SOLine)e.Row;
            if (row == null) return;
            CSAttributeDetail CSAns = PXSelectJoin<CSAttributeDetail, InnerJoin<CSAnswers, On<CSAnswers.attributeID, Equal<CSAttributeDetail.attributeID>>,
                              InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>>,
                              Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>,
                              And<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>>
                              >>>.Select(Base, row.InventoryID, "ACCITEMS");
                  
                SOLineExt rowExt = row.GetExtension<SOLineExt>();
                rowExt.UsrAccessoriesFrmStkItems = CSAns.Description;        
        }```

【问题讨论】:

    标签: c# attributes acumatica


    【解决方案1】:

    添加一个选择属性的用户字段。用户字段将显示您的答案。 我还没有完全测试,但应该很接近。

    #region UsrDiscountCategory
        [PXString(510)]
        [PXUIField(DisplayName="Discount Category")]
        [PXDBScalar(typeof(SearchFor<CSAnswers.value>.In<
            SelectFrom<CSAnswers>.
            InnerJoin<InventoryItem>.On<InventoryItem.noteID.IsEqual<CSAnswers.refNoteID>>.
            InnerJoin<SOLine>.On<SOLine.inventoryID.IsEqual<InventoryItem.inventoryID>>.
            Where<CSAnswers.attributeID.IsEqual<discCatAttr>>>))]
        public virtual string UsrDiscountCategory { get; set; }
        public abstract class usrDiscountCategory : PX.Data.BQL.BqlString.Field<usrDiscountCategory> { }
        #endregion
    
    public class discCatAttr : PX.Data.BQL.BqlString.Constant<discCatAttr>
    {
        public discCatAttr()
          : base("DISCCAT")
        {
        }
    }
    

    【讨论】:

      【解决方案2】:

      我们可以使用 UsrAccessoriesFrmStkItems 字段选择事件并填充值。

      aspx:

      <px:PXDropDown runat="server" ID="edUsrAccessoriesFrmStkItems" DataField="UsrAccessoriesFrmStkItems" />
      

      事件:

      protected virtual void SOLine_UsrAccessoriesFrmStkItems_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
          {
              SOLine row = e.Row as SOLine;
              if (row != null)
              {
                  List<string> allowedValues = new List<string>();               
      
                  foreach (CSAttributeDetail detail in PXSelectJoin<CSAttributeDetail, InnerJoin<CSAnswers, On<CSAnswers.attributeID, Equal<CSAttributeDetail.attributeID>>,
                                                       InnerJoin<InventoryItem, On<InventoryItem.noteID, Equal<CSAnswers.refNoteID>>>>,
                                                       Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>,And<CSAttributeDetail.attributeID, Equal<Required<CSAttributeDetail.attributeID>>>>>.Select(Base, row.InventoryID, "ACCITEMS"))
                  {
                      allowedValues.Add(detail.Description);
                  }
       e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 225, true, typeof(KNMCMagentoSetup.customerClasses).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedValues.ToArray(), false, null);
                  ((PXStringState)e.ReturnState).MultiSelect = true;
              }
          }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-08-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多