WeightSystem_OBJProxy.cs 2.79 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FObjBase;
using FLY.Weight.OBJ_INTERFACE;
using System.Net;
using FLY.Weight.Common;
using FLY.OBJComponents.Server.OBJProxy;
using System.ComponentModel;

namespace FLY.Weight.Server.OBJProxy
{
    public class WeightSystem_OBJProxy : FObj
    {
        WeightSystem data;
        SyncProp_OBJProxy syncProp_OBJProxy;
        PLCProxySystem_OBJProxy plcOS_OBJProxy;
        /// <summary>
        /// 流量
        /// </summary>
        Buffer_OBJProxy<FlyData_Flow> mFlowListOBJProxy;
        /// <summary>
        /// 每次配料记录
        /// </summary>
        Dictionary<WeighterC, Buffer_OBJProxy<FlyData_Mix>> mMixBufferOBJProxy = new Dictionary<WeighterC, Buffer_OBJProxy<FlyData_Mix>>();
        /// <summary>
        /// 下辊时,总配料比例记录
        /// </summary>
        Dictionary<WeighterC, Buffer_OBJProxy<FlyData_Mix>> mRollMixBufferOBJProxy = new Dictionary<WeighterC, Buffer_OBJProxy<FlyData_Mix>>();


        public WeightSystem_OBJProxy(int objsys_idx, WeightSystem data):base(objsys_idx)
        {
            ID = OBJ_INTERFACE.OBJ_INTERFACE.WEIGHTS_OBJ_ID;
            this.data = data;

            //--------------------------------------------------------------
            //属性同步
            Dictionary<string, INotifyPropertyChanged> objnames = new Dictionary<string, INotifyPropertyChanged>();
            objnames.Add(".", data);
            objnames.Add("Accessory", data.Accessory);
            for (int i = 0; i < data.Items.Count(); i++)
44
                objnames.Add($"Items[{i}]", data.Items[i]);
潘栩锋's avatar
潘栩锋 committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

            syncProp_OBJProxy = new SyncProp_OBJProxy(
                objsys_idx, ID + 1, objnames);

            plcOS_OBJProxy = new PLCProxySystem_OBJProxy(
                objsys_idx,
                OBJ_INTERFACE.OBJ_INTERFACE.WEIGHTS_OBJ_PLCOS_ID,
                data.PLCos
                );

            mFlowListOBJProxy = new Buffer_OBJProxy<FlyData_Flow>(
                objsys_idx,
                OBJ_INTERFACE.OBJ_INTERFACE.WEIGHTS_OBJ_FLOW_ID,
                data.FlowList);


            for (int i=0;i< data.Items.Count();i++)
            {
                WeighterC w = data.Items[i];
                mMixBufferOBJProxy.Add(
                    w, 
                    new Buffer_OBJProxy<FlyData_Mix>(
                        objsys_idx,
                        OBJ_INTERFACE.OBJ_INTERFACE.WEIGHTS_OBJ_MIX_ID(i),
                        data.MixBuffer[w]));

                mRollMixBufferOBJProxy.Add(
                    w,
                    new Buffer_OBJProxy<FlyData_Mix>(
                        objsys_idx,
                        OBJ_INTERFACE.OBJ_INTERFACE.WEIGHTS_OBJ_ROLLMIX_ID(i),
                        data.RollMixBuffer[w]));
            }
        }
    }
}