Esempio n. 1
0
        public static ClientGoods CreateClientGoods(RpcObject obj)
        {
            var goods = new ClientGoods();

            goods.Goods_ID         = obj.Get <long>("Goods_ID");
            goods.Goods_BarCode    = obj.Get <string>("Goods_Code");
            goods.Goods_Name       = obj.Get <string>("Goods_Name");
            goods.Goods_MainUnit   = obj.Get <string>("Goods_MainUnit");
            goods.Goods_SecondUnit = obj.Get <string>("Goods_SecondUnit");

            var d = obj.Get <NamedValue>("Goods_UnitConvertDirection");

            if (d != null)
            {
                if (d.Value == 0)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.双向转换;
                }
                else if (d.Value == 1)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.由主至辅;
                }
                else if (d.Value == 2)
                {
                    goods.Goods_UnitConvertDirection = GoodsUnitConvertDirection.由辅至主;
                }
            }

            goods.Goods_MainUnitRatio   = obj.Get <decimal?>("Goods_MainUnitRatio");
            goods.Goods_SecondUnitRatio = obj.Get <decimal?>("Goods_SecondUnitRatio");

            return(goods);
        }
Esempio n. 2
0
 public static decimal?GetNumberBySecondNumber(ClientGoods goods, decimal secondNumber)
 {
     if (goods.Goods_UnitConvertDirection == GoodsUnitConvertDirection.双向转换 || goods.Goods_UnitConvertDirection == GoodsUnitConvertDirection.由辅至主)
     {
         var number = secondNumber * goods.Goods_MainUnitRatio / goods.Goods_SecondUnitRatio;
         return(number);
     }
     return(null);
 }
Esempio n. 3
0
 public static void SetNumberBySecondNumber(ClientGoods goods)
 {
     if (goods.Goods_UnitConvertDirection == GoodsUnitConvertDirection.双向转换 || goods.Goods_UnitConvertDirection == GoodsUnitConvertDirection.由辅至主)
     {
         if (goods.Goods_SecondNumber.HasValue)
         {
             var number = goods.Goods_SecondNumber * goods.Goods_MainUnitRatio / goods.Goods_SecondUnitRatio;
             goods.Goods_Number = number;
         }
     }
 }