public CCMPNValue(string mpnName, int v, int min, int max)
 {
     this.name  = (MPN)Enum.Parse(typeof(MPN), mpnName);
     this.value = v;
     this.min   = min;
     this.max   = max;
 }
Ejemplo n.º 2
0
        // Token: 0x06000007 RID: 7 RVA: 0x0000241C File Offset: 0x0000061C
        public static string GetSelectedMenuFileName(MPN?mpn, Maid maid)
        {
            string result = string.Empty;

            if (mpn != null)
            {
                MPN?mpn2 = mpn;
                MPN mpn3 = MPN.set_maidwear;
                if (!(mpn2.GetValueOrDefault() == mpn3 & mpn2 != null))
                {
                    mpn2 = mpn;
                    mpn3 = MPN.set_mywear;
                    if (!(mpn2.GetValueOrDefault() == mpn3 & mpn2 != null))
                    {
                        mpn2 = mpn;
                        mpn3 = MPN.set_underwear;
                        if (!(mpn2.GetValueOrDefault() == mpn3 & mpn2 != null))
                        {
                            result = maid.GetProp(mpn.Value).strFileName;
                        }
                    }
                }
            }
            return(result);
        }
 public CCMPNValue(MPN name, int v, int min, int max)
 {
     this.name  = name;
     this.value = v;
     this.min   = min;
     this.max   = max;
 }
Ejemplo n.º 4
0
        public static MaidProp CreateProp(int minval, int maxval, int defval, MPN mpn, int type)
        {
            //NDebug.Assert(type == 0 || type == 1 || type == 2, "プロパティオブジェクトのタイプが不正です。");
            if (type > 2 || type < 0)
            {
                MyLog.Log("プロパティオブジェクトのタイプが不正です");
                return(null);
            }
            MaidProp maidProp = new MaidProp();

            maidProp.name = mpn.ToString();
            maidProp.type = type;
            maidProp.min  = minval;
            maidProp.max  = maxval;
            if (defval < minval)
            {
                defval = minval;
            }
            if (defval > maxval)
            {
                defval = maxval;
            }
            maidProp.value_Default = defval;
            maidProp.listSubProp   = null;
            maidProp.strFileName   = string.Empty;
            maidProp.temp_value    = (maidProp.value = defval);
            maidProp.idx           = (int)mpn;
            maidProp.boDut         = true;
            maidProp.boTempDut     = false;
            return(maidProp);
        }
Ejemplo n.º 5
0
        public static void m_dicSliderPartsTypeBtnName_ext()
        {
            if (m_dicSliderPartsTypeBtnName_ext_flag)
            {
                return;
            }
            m_dicSliderPartsTypeBtnName_ext_flag = true;

            string text = "edit_category_define_creator.nei";

            Dictionary <SceneEditInfo.EMenuCategory, int> dictionary = new Dictionary <SceneEditInfo.EMenuCategory, int>();

            using (AFileBase afileBase = GameUty.FileSystemMod.FileOpen(text))
            {
                using (CsvParser csvParser = new CsvParser())
                {
                    bool condition = csvParser.Open(afileBase);
                    NDebug.Assert(condition, text + "\nopen failed.");
                    for (int i = 1; i < csvParser.max_cell_y; i++)
                    {
                        if (csvParser.IsCellToExistData(0, i))
                        {
                            int num = 0;
                            MPN key = MPN.null_mpn;
                            try
                            {
                                key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {
                            }
                            SceneEditInfo.CCateNameType ccateNameType = new SceneEditInfo.CCateNameType();
                            ccateNameType.m_eMenuCate = SceneEditInfo.EMenuCategory.頭;
                            try
                            {
                                ccateNameType.m_eMenuCate = (SceneEditInfo.EMenuCategory)Enum.Parse(typeof(SceneEditInfo.EMenuCategory), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {
                            }
                            ccateNameType.m_eType = SceneEditInfo.CCateNameType.EType.Item;
                            try
                            {
                                ccateNameType.m_eType = (SceneEditInfo.CCateNameType.EType)Enum.Parse(typeof(SceneEditInfo.CCateNameType.EType), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {
                            }
                            ccateNameType.m_ePartsType          = csvParser.GetCellAsString(num++, i);
                            ccateNameType.m_strBtnPartsTypeName = csvParser.GetCellAsString(num++, i);
                            ccateNameType.m_nIdx = 50 + i;
                            SceneEditInfo.dicPartsTypePair_[key] = ccateNameType;
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public static void SetProp(Maid __instance, MPN idx, int val, bool f_bTemp, MaidProp[] ___m_aryMaidProp)
 {
     if (configEntryUtill["SetProp"])
     {
         if (__instance.Visible)
         {
             print("SetProp2", ___m_aryMaidProp[(int)idx]);
         }
     }
 }
Ejemplo n.º 7
0
 public static void DelProp(Maid __instance, MPN idx, bool f_bTemp, MaidProp[] ___m_aryMaidProp)
 {
     if (configEntryUtill["DelProp", false])
     {
         if (__instance.Visible)
         {
             print("DelProp", ___m_aryMaidProp[(int)idx]);
         }
     }
 }
Ejemplo n.º 8
0
        public static void ManMenuAdd(PhotoManEditManager self)
        {
            if (ManMenuAdd_run)
            {
                return;
            }
            ManMenuAdd_run = true;

            FieldInfo        menu_file_name_list_    = typeof(PhotoManEditManager).GetField("menu_file_name_list_", BindingFlags.Static | BindingFlags.NonPublic);
            HashSet <string> menu_filename_list_val  = (HashSet <string>)menu_file_name_list_.GetValue(null);
            FieldInfo        man_body_menu_list_self = self.GetType().GetField("man_body_menu_list_", BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo        man_head_menu_list_self = self.GetType().GetField("man_head_menu_list_", BindingFlags.NonPublic | BindingFlags.Instance);


            HashSet <string>           menu_list = new HashSet <string>();
            List <SceneEdit.SMenuItem> head_list = new List <SceneEdit.SMenuItem>();
            List <SceneEdit.SMenuItem> body_list = new List <SceneEdit.SMenuItem>();
            MPN body = (MPN)Enum.Parse(typeof(MPN), "body");

            foreach (string filename in GameUty.ModOnlysMenuFiles)
            {
                if (filename.Contains("mhead") || filename.Contains("mbody"))
                {
                    menu_list.Add(filename);
                }
            }

            Debug.Log($"menu list pre union{ menu_list}");
            if (menu_filename_list_val != null)
            {
                menu_list.UnionWith(menu_filename_list_val);
            }
            Debug.Log($"menu list post union{ menu_list}");
            foreach (string filename in menu_list)

            {
                SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem();
                if (SceneEdit.GetMenuItemSetUP(smenuItem, filename, true))
                {
                    if (smenuItem.m_mpn == body)
                    {
                        body_list.Add(smenuItem);
                    }
                    else
                    {
                        head_list.Add(smenuItem);
                    }
                }
            }


            menu_file_name_list_.SetValue(null, menu_list);
            man_body_menu_list_self.SetValue(self, body_list);
            man_head_menu_list_self.SetValue(self, head_list);
        }
Ejemplo n.º 9
0
 public MaidProp this[MPN mpn]
 {
     get
     {
         return(maidProps[mpn]);
     }
     set
     {
         maidProps[mpn] = value;
     }
 }
Ejemplo n.º 10
0
 // Token: 0x0600017D RID: 381 RVA: 0x0000E578 File Offset: 0x0000C778
 public SlotInfo(TBody.SlotID id, MPN mpn, string displayName, bool enable, bool maskable)
 {
     this.Id          = id;
     this.Name        = this.Id.ToString();
     this.mpn         = mpn;
     this.DisplayName = displayName;
     this.LongName    = displayName + " [" + this.Name + "]";
     this.no          = -1;
     this.enable      = enable;
     this.maskable    = maskable;
 }
 public SlotInfo(TBody.SlotID id, MPN mpn, string displayName, bool enable, bool maskable)
 {
     Id            = id;
     Name          = Id.ToString();
     this.mpn      = mpn;
     DisplayName   = displayName;
     LongName      = displayName + " [" + Name + "]";
     no            = -1;
     this.enable   = enable;
     this.maskable = maskable;
 }
Ejemplo n.º 12
0
 private static void SetMaidPropRandom(Maid m_maid, MPN tag)
 {
     try
     {
         MaidProp maidProp = m_maid.GetProp(tag);
         m_maid.SetProp(tag, UnityEngine.Random.Range(maidProp.min, maidProp.max));
     }
     catch (Exception e)
     {
         MyLog.LogError("SetMaidPropRandom", e.ToString());
     }
 }
Ejemplo n.º 13
0
 public void WriteProps(Maid maid)
 {
     foreach (var kv in Sliders)
     {
         string name   = kv.Key;
         Slider slider = kv.Value;
         MPN    mpn    = Helper.ToEnum <MPN>(name, MPN.null_mpn);
         if (mpn != MPN.null_mpn)
         {
             MaidProp maidProp = maid.GetProp(mpn);
             maidProp.min = (int)slider.min;
             maidProp.max = (int)slider.max;
         }
     }
 }
Ejemplo n.º 14
0
 public static void mul(int[] dest, int[] x, int xlen, int[] y, int ylen)
 {
     dest[xlen] = MPN.mul_1(dest, x, xlen, y[0]);
     for (int i = 1; i < ylen; i++)
     {
         long yword = (long)y[i] & 0xffffffffL;
         long carry = 0;
         for (int j = 0; j < xlen; j++)
         {
             carry      += ((long)x[j] & 0xffffffffL) * yword + ((long)dest[i + j] & 0xffffffffL);
             dest[i + j] = (int)carry;
             carry       = (long)((ulong)carry >> 32);
         }
         dest[i + xlen] = (int)carry;
     }
 }
Ejemplo n.º 15
0
        public static void m_dicPartsTypeWearMode_ext()
        {
            if (m_dicPartsTypeWearMode_ext_flag)
            {
                return;
            }
            m_dicPartsTypeWearMode_ext_flag = true;
            string text = "edit_mask_define_creator.nei";

            SceneEditInfo.dicPartsTypeWearMode_ = new Dictionary <MPN, TBody.MaskMode>();
            using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
            {
                using (CsvParser csvParser = new CsvParser())
                {
                    bool condition = csvParser.Open(afileBase);

                    for (int i = 1; i < csvParser.max_cell_y; i++)
                    {
                        if (csvParser.IsCellToExistData(0, i))
                        {
                            int num = 0;
                            MPN key = MPN.null_mpn;
                            try
                            {
                                key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {}
                            TBody.MaskMode value = TBody.MaskMode.None;
                            try
                            {
                                value = (TBody.MaskMode)Enum.Parse(typeof(TBody.MaskMode), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {
                            }

                            SceneEditInfo.dicPartsTypeWearMode_[key] = value;
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
        public static void m_dicPartsTypeCamera_ext()
        {
            if (m_dicPartsTypeCamera_ext_flag)
            {
                return;
            }
            m_dicPartsTypeCamera_ext_flag = true;
            string text = "edit_attention_point_define_creator.nei";

            using (AFileBase afileBase = GameUty.FileSystemMod.FileOpen(text))
            {
                using (CsvParser csvParser = new CsvParser())
                {
                    bool condition = csvParser.Open(afileBase);
                    NDebug.Assert(condition, text + "\nopen failed.");
                    for (int i = 1; i < csvParser.max_cell_y; i++)
                    {
                        if (csvParser.IsCellToExistData(0, i))
                        {
                            SceneEditInfo.CamToBone value = default(SceneEditInfo.CamToBone);
                            int num = 0;
                            MPN key = MPN.null_mpn;
                            try
                            {
                                key = (MPN)Enum.Parse(typeof(MPN), csvParser.GetCellAsString(num++, i));
                            }
                            catch
                            {}
                            value.bone     = csvParser.GetCellAsString(num++, i);
                            value.angle    = wf.Parse.Vector2(csvParser.GetCellAsString(num++, i));
                            value.distance = csvParser.GetCellAsReal(num++, i);
                            SceneEditInfo.m_dicPartsTypeCamera_[key] = value;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 157 임시조치용
        /// </summary>
        /// <param name="t"></param>
        /// <param name="f_mpn"></param>
        /// <param name="f_slot"></param>
        /// <param name="tbskin"></param>
        // public void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot, TBodySkin tbskin)
        //[HarmonyPatch(typeof(BoneMorph_), "InitBoneMorphEdit",typeof(Transform),typeof(MPN),typeof(TBody.SlotID),typeof(TBodySkin)), HarmonyPrefix]
        public static void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot, TBodySkin tbskin)
        {
            MyLog.LogMessage(
                "InitBoneMorphEdit"
                // , t.name// 의미 없음
                , f_mpn // MPN 가 SlotID 보다 많음
                , f_slot
                , tbskin.obj_tr.name
                );
            //tbskin.obj_tr = t;

            /*
             * if (this.IsCrcBody)
             * {
             *  this.bonemorph = new TMorphBone();
             *  this.bonemorph.Init();
             * }
             * else
             * {
             *  this.bonemorph = new BoneMorph_();
             *  this.bonemorph.Init();
             * }
             */
        }
Ejemplo n.º 18
0
        /** Extract a bit-field as an unsigned integer. */
        public static IntNum extract(IntNum x, int startBit, int endBit)
        {
            //System.err.print("extract([");  if (x.words!=null) MPN.dprint(x.words);
            //System.err.println (","+x.ival+"], start:"+startBit+", end:"+endBit);
            if (endBit < 32)
            {
                int word0 = x.words == null ? x.ival : x.words[0];
                return(IntNum.make((word0 & ~((-1) << endBit)) >> startBit));
            }
            int x_len;

            if (x.words == null)
            {
                if (x.ival >= 0)
                {
                    return(IntNum.make(startBit >= 31 ? 0 : (x.ival >> startBit)));
                }
                x_len = 1;
            }
            else
            {
                x_len = x.ival;
            }
            bool neg = x.isNegative();

            if (endBit > 32 * x_len)
            {
                endBit = 32 * x_len;
                if (!neg && startBit == 0)
                {
                    return(x);
                }
            }
            else
            {
                x_len = (endBit + 31) >> 5;
            }
            int length = endBit - startBit;

            if (length < 64)
            {
                long l;
                if (x.words == null)
                {
                    l = x.ival >> (startBit >= 32 ? 31 : startBit);
                }
                else
                {
                    l = MPN.rshift_long(x.words, x_len, startBit);
                }
                return(IntNum.make(l & ~((-1L) << length)));
            }
            int startWord = startBit >> 5;
            // Allocate a work buffer, which has to be large enough for the result
            // AND large enough for all words we use from x (including possible
            // partial words at both ends).
            int buf_len = (endBit >> 5) + 1 - startWord;

            int[] buf = new int[buf_len];
            if (x.words == null)  // x < 0.
            {
                buf[0] = startBit >= 32 ? -1 : (x.ival >> startBit);
            }
            else
            {
                x_len    -= startWord;
                startBit &= 31;
                MPN.rshift0(buf, x.words, startWord, x_len, startBit);
            }
            x_len       = length >> 5;
            buf[x_len] &= ~((-1) << length);
            return(IntNum.make(buf, x_len + 1));
        }
 public SlotInfo(TBody.SlotID id, MPN mpn, string displayName, bool enable, bool maskable) {
     this.Id = id;
     this.Name = Id.ToString();
     this.mpn = mpn;
     this.DisplayName = displayName;
     this.LongName = displayName + " [" + Name + "]";
     this.no = -1;
     this.enable = enable;
     this.maskable = maskable;
 }
 public SlotInfo(TBody.SlotID id, MPN mpn, string displayName, bool enable)
     :this(id, mpn, displayName, enable, true) {
 }
Ejemplo n.º 21
0
        // Token: 0x06000066 RID: 102 RVA: 0x00007270 File Offset: 0x00005470
        public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes)
        {
            Maid       currentMaid = this._holder.CurrentMaid;
            PresetData presetData  = new PresetData
            {
                name = presetName
            };

            foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values)
            {
                if (slotInfo.enable)
                {
                    TBodySkin slot = currentMaid.body0.GetSlot((int)slotInfo.Id);
                    SlotState mask;
                    if (slot.obj == null)
                    {
                        mask = SlotState.NotLoaded;
                    }
                    else if (!slot.boVisible)
                    {
                        mask = SlotState.Masked;
                    }
                    else
                    {
                        mask = SlotState.Displayed;
                    }
                    Material[] materials = this._holder.GetMaterials(slot);
                    if (materials.Length != 0)
                    {
                        CCSlot ccslot = new CCSlot(slotInfo.Id)
                        {
                            mask = mask
                        };
                        foreach (Material material in materials)
                        {
                            ShaderType shaderType = ShaderType.Resolve(material.shader.name);
                            if (shaderType != ShaderType.UNKNOWN)
                            {
                                CCMaterial ccmaterial = new CCMaterial(material, shaderType);
                                ccslot.Add(ccmaterial);
                                foreach (ShaderPropTex shaderPropTex in shaderType.texProps)
                                {
                                    Texture2D texture2D = material.GetTexture(shaderPropTex.propId) as Texture2D;
                                    if (!(texture2D == null) && !string.IsNullOrEmpty(texture2D.name))
                                    {
                                        TextureInfo textureInfo = new TextureInfo();
                                        ccmaterial.Add(textureInfo);
                                        textureInfo.propName = shaderPropTex.keyName;
                                        textureInfo.texFile  = texture2D.name;
                                        TextureModifier.FilterParam filter = this._texModifier.GetFilter(currentMaid, slotInfo.Id.ToString(), material.name, texture2D.name);
                                        if (filter != null && !filter.HasNotChanged())
                                        {
                                            textureInfo.filter = new TexFilter(filter);
                                        }
                                        Vector2 textureOffset = material.GetTextureOffset(shaderPropTex.propId);
                                        if (Math.Abs(textureOffset.x) > 0.001f)
                                        {
                                            textureInfo.offsetX = new float?(textureOffset.x);
                                        }
                                        if (Math.Abs(textureOffset.y) > 0.001f)
                                        {
                                            textureInfo.offsetY = new float?(textureOffset.y);
                                        }
                                        Vector2 textureScale = material.GetTextureScale(shaderPropTex.propId);
                                        if (Math.Abs(textureScale.x) > 0.001f)
                                        {
                                            textureInfo.scaleX = new float?(textureScale.x);
                                        }
                                        if (Math.Abs(textureScale.y) > 0.001f)
                                        {
                                            textureInfo.scaleY = new float?(textureScale.y);
                                        }
                                    }
                                }
                            }
                        }
                        presetData.slots.Add(ccslot);
                    }
                }
            }
            for (int k = TypeUtil.BODY_START; k <= TypeUtil.BODY_END; k++)
            {
                MPN      mpn  = (MPN)Enum.ToObject(typeof(MPN), k);
                MaidProp prop = currentMaid.GetProp(mpn);
                if (prop != null)
                {
                    if (prop.type == 1 || prop.type == 2)
                    {
                        presetData.mpnvals.Add(new CCMPNValue(mpn, prop.value, prop.min, prop.max));
                    }
                    else if (prop.type == 3 && prop.nFileNameRID != 0)
                    {
                        presetData.mpns.Add(new CCMPN(mpn, prop.strFileName));
                    }
                }
            }
            for (int l = TypeUtil.WEAR_START; l <= TypeUtil.WEAR_END; l++)
            {
                MPN      mpn2  = (MPN)Enum.ToObject(typeof(MPN), l);
                MaidProp prop2 = currentMaid.GetProp(mpn2);
                if (prop2 != null && prop2.nFileNameRID != 0)
                {
                    presetData.mpns.Add(new CCMPN(mpn2, prop2.strFileName));
                }
            }
            for (MaidParts.PARTS_COLOR parts_COLOR = TypeUtil.PARTS_COLOR_START; parts_COLOR <= TypeUtil.PARTS_COLOR_END; parts_COLOR++)
            {
                MaidParts.PartsColor partsColor = currentMaid.Parts.GetPartsColor(parts_COLOR);
                presetData.partsColors[parts_COLOR.ToString()] = new CCPartsColor(partsColor);
            }
            presetData.delNodes = new Dictionary <string, bool>(dDelNodes);
            LogUtil.Debug(new object[]
            {
                "create preset...",
                fileName
            });
            this.SavePreset(fileName, presetData);
        }
Ejemplo n.º 22
0
        // Token: 0x0600001C RID: 28 RVA: 0x000028E8 File Offset: 0x00000AE8
        public static MenuInfo parseMod(string filePath)
        {
            MenuInfo menuInfo = new MenuInfo();

            menuInfo.Priority = 1000f;
            byte[] array = null;
            try
            {
                using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
                {
                    if (fileStream == null)
                    {
                        return(null);
                    }
                    array = new byte[fileStream.Length];
                    fileStream.Read(array, 0, (int)fileStream.Length);
                }
            }
            catch (Exception)
            {
            }
            if (array == null)
            {
                return(null);
            }
            using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(array), Encoding.UTF8))
            {
                if (binaryReader.ReadString() != "CM3D2_MOD")
                {
                    return(null);
                }
                binaryReader.ReadInt32();
                menuInfo.IconName = binaryReader.ReadString();
                binaryReader.ReadString();
                menuInfo.ItemName = binaryReader.ReadString();
                string value = binaryReader.ReadString();
                MPN    mpn   = MPN.null_mpn;
                if (!EnumUtil.TryParse <MPN>(value, true, out mpn))
                {
                    return(null);
                }
                menuInfo.MPN = mpn;
                binaryReader.ReadString();
                if (!EnumUtil.TryParse <MPN>(binaryReader.ReadString(), true, out mpn))
                {
                    return(null);
                }
                if (mpn != MPN.null_mpn)
                {
                    binaryReader.ReadString();
                }
                string text = binaryReader.ReadString();
                if (text.Contains("色セット"))
                {
                    string[] array2 = text.Replace("\r\n", "\n").Split(new char[]
                    {
                        '\n'
                    });
                    for (int i = 0; i < array2.Length; i++)
                    {
                        string[] array3 = array2[i].Split(new char[]
                        {
                            '\t'
                        }, StringSplitOptions.RemoveEmptyEntries);
                        if (array3.Length > 2 && array3[0] == "色セット" && EnumUtil.TryParse <MPN>(array3[1], true, out menuInfo.ColorSetMPN))
                        {
                            menuInfo.ColorSetMenuName = array3[2];
                            break;
                        }
                    }
                }
                int num = binaryReader.ReadInt32();
                for (int j = 0; j < num; j++)
                {
                    string strA  = binaryReader.ReadString();
                    int    count = binaryReader.ReadInt32();
                    byte[] data  = binaryReader.ReadBytes(count);
                    if (string.Compare(strA, menuInfo.IconName, true) == 0)
                    {
                        menuInfo.Icon = new Texture2D(1, 1, TextureFormat.RGBA32, false);
                        menuInfo.Icon.LoadImage(data);
                    }
                }
            }
            return(menuInfo);
        }
 public CCMPN(string mpnName, string filename)
 {
     this.name     = (MPN)Enum.Parse(typeof(MPN), mpnName);
     this.filename = filename;
 }
 public CCMPNValue(MPN name, int v, int min, int max) {
     this.name = name;
     this.value = v;
     this.min = min;
     this.max = max;
 }
Ejemplo n.º 25
0
    public static int set_str(int[] dest, sbyte[] str, int str_len, int @base)
    {
        int size = 0;

        if ((@base & (@base - 1)) == 0)
        {
            int next_bitpos      = 0;
            int bits_per_indigit = 0;
            for (int i = @base; (i >>= 1) != 0;)
            {
                bits_per_indigit++;
            }
            int res_digit = 0;
            for (int i = str_len; --i >= 0;)
            {
                int inp_digit = str[i];
                res_digit   |= inp_digit << next_bitpos;
                next_bitpos += bits_per_indigit;
                if (next_bitpos >= 32)
                {
                    dest[size++] = res_digit;
                    next_bitpos -= 32;
                    res_digit    = inp_digit >> (bits_per_indigit - next_bitpos);
                }
            }
            if (res_digit != 0)
            {
                dest[size++] = res_digit;
            }
        }
        else
        {
            int indigits_per_limb = MPN.chars_per_word(@base);
            int str_pos           = 0;
            while (str_pos < str_len)
            {
                int chunk = str_len - str_pos;
                if (chunk > indigits_per_limb)
                {
                    chunk = indigits_per_limb;
                }
                int res_digit = str[str_pos++];
                int big_base  = @base;
                while (--chunk > 0)
                {
                    res_digit = res_digit * @base + str[str_pos++];
                    big_base *= @base;
                }
                int cy_limb;
                if (size == 0)
                {
                    cy_limb = res_digit;
                }
                else
                {
                    cy_limb  = MPN.mul_1(dest, dest, size, big_base);
                    cy_limb += MPN.add_1(dest, dest, size, res_digit);
                }
                if (cy_limb != 0)
                {
                    dest[size++] = cy_limb;
                }
            }
        }
        return(size);
    }
        private static IEnumerator exportAllHairMenus(string[] fileNames, bool isModList, int num)
        {
            run[num] = true;
            UnityEngine.Debug.Log("Exporting Menus Start" + fileNames.Length);
            Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);

            if (maid != null)
            {
                for (int i = 0; i < fileNames.Length; i++)
                {
                    string fileNameFullPath = fileNames[i];
                    bool   isMod            = isModList || fileNameFullPath.IndexOf("mod_") == 0;
                    if (((isMod && includeMods) || (!isMod && !onlyMods)) &&
                        (fileNameFullPath.Contains("hairf") || fileNameFullPath.Contains("hairr") || fileNameFullPath.Contains("hairs") || fileNameFullPath.Contains("hairt")))
                    {
                        string[] filePathSplit = fileNameFullPath.Split('\\');
                        string   fileName      = filePathSplit[filePathSplit.Length - 1];

                        if (!File.Exists(Path.Combine(newMenuPath, fileName)) || overwriteExisting)
                        {
                            MenuObj menu = getMenu(fileNameFullPath);

                            //Only process the file if it is a hair
                            if (new string[] { "hairf", "hairr", "hairs", "hairt" }.Contains(menu.category.ToLower()))
                            {
                                TBody.SlotID slotID = TBody.SlotID.hairAho;
                                MPN          mpnID  = MPN.hairaho;
                                switch (menu.category.ToLower())
                                {
                                case "hairf":
                                    slotID = TBody.SlotID.hairF;
                                    mpnID  = MPN.hairf;
                                    break;

                                case "hairr":
                                    slotID = TBody.SlotID.hairR;
                                    mpnID  = MPN.hairr;
                                    break;

                                case "hairs":
                                    slotID = TBody.SlotID.hairS;
                                    mpnID  = MPN.hairs;
                                    break;

                                case "hairt":
                                    slotID = TBody.SlotID.hairT;
                                    mpnID  = MPN.hairt;
                                    break;
                                }

                                //Cache the current selection
                                string oldFileName = maid.GetProp(mpnID).strFileName;

                                //Set the hair to the file
                                Menu.ProcScript(maid, fileNameFullPath, false);

                                //Export the hair
                                if (everyBone && maid.body0.goSlot[(int)slotID] != null && maid.body0.goSlot[(int)slotID].morph != null && maid.body0.goSlot[(int)slotID].morph.BoneNames != null && maid.body0.goSlot[(int)slotID].morph.BoneNames.Count > 0)
                                {
                                    UnityEngine.Debug.Log("Creating Menu for all bones");
                                    List <HairLengthTargetObj> listTarget = new List <HairLengthTargetObj>();
                                    for (int j = 0; j < maid.body0.goSlot[(int)slotID].morph.BoneNames.Count; j++)
                                    {
                                        string boneName = maid.body0.goSlot[(int)slotID].morph.BoneNames[j];
                                        if (boneName.Contains("yure"))
                                        {
                                            HairLengthTargetObj target = new HairLengthTargetObj();
                                            target.trTarget  = boneName;
                                            target.vScaleMin = new Vector3(0.3f, 1f, 1f);
                                            target.vScaleMax = new Vector3(2f, 1f, 1f);
                                            listTarget.Add(target);
                                        }
                                    }

                                    this1.StartCoroutine(createNewHairMenu(fileName, listTarget, menu, false));
                                }
                                else
                                {
                                    if (slotID != TBody.SlotID.hairAho &&
                                        maid.body0.goSlot[(int)slotID] != null &&
                                        maid.body0.goSlot[(int)slotID].m_HairLengthCtrl != null && maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList != null &&
                                        maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList.ContainsKey("AutoConv") &&
                                        maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList["AutoConv"].listTarget != null &&
                                        maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList["AutoConv"].listTarget.Count != 0)
                                    {
                                        //CM
                                        UnityEngine.Debug.Log("Createing Menu for AutoConv");
                                        List <HairLengthTargetObj> listTarget = new List <HairLengthTargetObj>();
                                        for (int j = 0; j < maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList["AutoConv"].listTarget.Count; j++)
                                        {
                                            TBodySkin.HairLengthCtrl.HairLengthTarget orig = maid.body0.goSlot[(int)slotID].m_HairLengthCtrl.HairLengthGroupList["AutoConv"].listTarget[j];
                                            HairLengthTargetObj target = new HairLengthTargetObj();
                                            target.trTarget  = orig.trTarget.name;
                                            target.vScaleMin = orig.vScaleMin;
                                            target.vScaleMax = orig.vScaleMax;
                                            listTarget.Add(target);
                                        }
                                        this1.StartCoroutine(createNewHairMenu(fileName, listTarget, menu, true));
                                    }
                                    else
                                    {
                                        //COM
                                        //UnityEngine.Debug.Log("Creating Menu for standard");
                                        this1.StartCoroutine(createNewHairMenu(fileName, null, menu, true));
                                    }
                                }

                                //Revert to the old selection
                                Menu.ProcScript(maid, oldFileName, false);
                            }
                        }
                    }
                }
            }
            UnityEngine.Debug.Log("Exporting Menus End" + fileNames.Length);
            run[num] = false;
            yield return(null);
        }
Ejemplo n.º 27
0
 // Token: 0x0600017C RID: 380 RVA: 0x0000E569 File Offset: 0x0000C769
 public SlotInfo(TBody.SlotID id, MPN mpn, string displayName, bool enable) : this(id, mpn, displayName, enable, true)
 {
 }
Ejemplo n.º 28
0
        public static bool IsBody(MPN mpn)
        {
            var mpnNo = (int)mpn;

            return(BODY_START <= mpnNo && mpnNo <= BODY_END);
        }
Ejemplo n.º 29
0
        public async Task <ReelMoveResDto> ReelMove(ReelMoveDto inputDto)
        {
            // Logger.Info("tm1" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss ffff"));

            // 获取调拨策略信息
            ReelMoveMethod reelMoveMethod = await _repositoryRMM.GetAll().Where(m => m.Id == inputDto.ReelMoveMethodId).Include(m => m.OutStorages).FirstOrDefaultAsync();

            // 条码解析信息
            ReelDto reelDto = null;

            // 料盘信息
            Reel reel = null;

            // 料盘物料信息
            MPN reelMpn = null;

            // 日志信息
            ReelMoveLog reelMoveLog = new ReelMoveLog()
            {
                ReelMoveMethodId = reelMoveMethod.Id
            };

            // 返回信息
            ReelMoveResDto resDto = new ReelMoveResDto()
            {
                IsContinuity = inputDto.IsContinuity, Msg = "操作成功", NextShlefLab = inputDto.ShlefLab
            };

            // 下架货架信息
            StorageLocation shelfUp = null;

            // 上架货架信息
            StorageLocation shelfOn = null;

            // 条码解析
            Func <Task> BarCodeAnalysis = new Func <Task>(async() =>
            {
                if (reelDto == null)
                {
                    var analysisRes = await _barCodeAnalysisAppService.Analysis(new BaseData.BarCodeAnalysiss.Dto.AnalysisDto()
                    {
                        BarCode = inputDto.BarCode, DtoName = "ReelDto"
                    });
                    if (!analysisRes.Success)
                    {
                        resDto.Msg = analysisRes.Msg;
                        throw new LYException(resDto.Msg);
                    }
                    else
                    {
                        reelDto = analysisRes.Result as ReelDto;
                    }
                }
            });

            // 检查料盘
            Func <Task> CheckReel = new Func <Task>(async() =>
            {
                if (reelDto == null)
                {
                    await BarCodeAnalysis();
                }

                if (reel == null)
                {
                    reel = await _repository.FirstOrDefaultAsync(reelDto.Id);
                    if (reel == null)
                    {
                        throw new LYException(reelDto.Id + "不存在,请先进行料卷注册");
                    }

                    reelMoveLog.ReelId   = reel.Id;
                    reelMoveLog.PartNoId = reel.PartNoId;
                    reelMoveLog.Qty      = reel.Qty;
                }
            });

            // 检查库位信息
            Func <Task> CheckShelfOn = new Func <Task>(async() =>
            {
                if (shelfOn == null)
                {
                    shelfOn = await _repositorysl.FirstOrDefaultAsync(inputDto.ShlefLab);

                    if (shelfOn == null)
                    {
                        resDto.Msg = "库位[" + inputDto.ShlefLab + "]不存在";
                        throw new LYException(resDto.Msg);
                    }

                    reelMoveLog.StorageLocationId = shelfOn.Id;
                }
            });

            // 获取物料信息
            Func <Task> CheckMPN = new Func <Task>(async() =>
            {
                if (reelMpn == null)
                {
                    reelMpn = await _repositorympn.FirstOrDefaultAsync(reelDto.PartNoId);
                    if (reelMpn == null)
                    {
                        resDto.Msg = "料号[" + reel.PartNoId + "]未维护";
                        throw new LYException(resDto.Msg);
                    }
                }
            });

            // 获取物料库位信息
            Func <Task> GetShelfUp = new Func <Task>(async() =>
            {
                shelfUp = await _repositorysl.FirstOrDefaultAsync(reel.StorageLocationId);
                if (shelfUp == null)
                {
                    resDto.Msg = "料盘[" + reel.Id + "]未上架";
                    throw new LYException(resDto.Msg);
                }
                reelMoveLog.StorageLocationId = shelfUp.Id;
            });

            foreach (var allocationType in reelMoveMethod.AllocationTypes)
            {
                switch (allocationType)
                {
                case AllocationType.Move:
                case AllocationType.OnSL:
                case AllocationType.UpSl:
                case AllocationType.Send:
                case AllocationType.Return:
                case AllocationType.Received:
                case AllocationType.SendFirstReel:
                case AllocationType.SupplyReel:
                    if (reel == null)         // 进行料卷检查
                    {
                        await CheckReel();
                    }

                    switch (allocationType)
                    {
                    case AllocationType.Move:         // 转仓

                        #region  转仓
                        // 检查料卷调出仓是否合法
                        if (!reelMoveMethod.OutStorages.Select(s => s.StorageId).Contains(reel.StorageId))
                        {
                            resDto.Msg = "料卷不属于该调拨策略的调出仓[" + string.Join('|', reelMoveMethod.OutStorages.Select(s => s.StorageId)) + "]";
                            throw new LYException(resDto.Msg);
                        }
                        // 进行转仓
                        reel.StorageId = reelMoveMethod.InStorageId;

                        #endregion
                        break;

                    case AllocationType.OnSL:         // 上架

                        #region  架
                        if (shelfOn == null)
                        {
                            await CheckShelfOn();         // 检查库位信息
                        }

                        // 库位是否有料
                        if (shelfOn.ReelId != null)
                        {
                            resDto.Msg = "库位[" + inputDto.ShlefLab + "]已绑定料卷[" + shelfOn.ReelId + "]";
                            throw new LYException(1, resDto.Msg);
                        }

                        // 库位是否在转入仓
                        if (shelfOn.StorageId != reelMoveMethod.InStorageId)
                        {
                            resDto.Msg = "库位[" + inputDto.ShlefLab + "]不不属于[" + reelMoveMethod.InStorageId + "]仓";
                            throw new LYException(1, resDto.Msg);
                        }

                        // 料卷是否上架
                        if (reel.StorageLocationId != null)
                        {
                            resDto.Msg = "料卷[" + reel.Id + "]已经上架[" + reel.StorageLocationId + "]";
                            throw new LYException(resDto.Msg);
                        }

                        // 查询物料可用区域

                        var mpnA = _repositorysMPNA.GetAll().Where(r => r.MPNId == reel.PartNoId).ToArray();

                        if (mpnA.Length > 0 && !mpnA.Select(r => r.StorageAreaId).Contains(shelfOn.StorageAreaId))
                        {
                            resDto.Msg = "物料[" + reel.PartNoId + "]允许上架分区为[" + string.Join('|', mpnA.Select(r => r.StorageAreaId)) + "]";
                            throw new LYException(resDto.Msg);
                        }
                        else
                        {
                            if (shelfOn.StorageAreaId != null && !mpnA.Select(r => r.StorageAreaId).Contains(shelfOn.StorageAreaId))
                            {
                                resDto.Msg = "分区[" + shelfOn.StorageAreaId + "]不允许物料[" + reel.PartNoId + "]上架";
                                throw new LYException(resDto.Msg);
                            }
                        }
                        // Logger.Info("tm91" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss ffff"));
                        // 寻找下一个空库位
                        var nextShelf = await _repositorysl.GetAll()
                                        .Where(s =>
                                               s.MainBoardId == shelfOn.MainBoardId &&
                                               s.PositionId > shelfOn.PositionId &&
                                               (s.ReelId == null || s.ReelId.Length == 0))
                                        .OrderBy(s => s.PositionId)
                                        .FirstOrDefaultAsync();

                        // Logger.Info("tm92" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss ffff"));
                        if (nextShelf != null)
                        {
                            resDto.NextShlefLab = nextShelf.Id;
                        }
                        else
                        {
                            resDto.IsContinuity = false;
                        }

                        // 进行上架双向绑定
                        reel.StorageLocationId = shelfOn.Id;
                        shelfOn.ReelId         = reel.Id;

                        // 保存上架信息
                        // _repositorysl.Update(shelfOn);
                        #endregion
                        break;

                    case AllocationType.UpSl:         // 下架

                        #region  架
                        await GetShelfUp();

                        // 清除双向绑定
                        shelfUp.ReelId         = null;
                        reel.StorageLocationId = null;
                        LightService.LightOrder(new List <StorageLight>()
                        {
                            new StorageLight()
                            {
                                ContinuedTime  = 10,
                                LightOrder     = 0,
                                MainBoardId    = shelfUp.MainBoardId,
                                LightColor     = shelfUp.LightColor,
                                RackPositionId = shelfUp.PositionId
                            }
                        });
                        #endregion
                        break;

                    case AllocationType.Send:         // 发料

                        #region 发料
                        // 检测发料临时表里面有没有该数据
                        var sendtemp = await _repositoryRST.FirstOrDefaultAsync(reel.Id);

                        if (sendtemp == null)
                        {
                            resDto.Msg = "料卷未被挑料";
                            throw new LYException(resDto.Msg);
                        }
                        // 查询挑料料站表行数据
                        var readySlot = await _repositorySlot.FirstOrDefaultAsync(sendtemp.SlotId);

                        if (sendtemp.IsSend)
                        {
                            if (readySlot != null)
                            {
                                resDto.Msg = @"料卷已经发料    " + sendtemp.FisrtStorageLocationId + "" + "\r\n站位信息: \r\n" + "面别: [" + (readySlot.BoardSide == SideType.B ? "S" : "C") + "]\r\n机器: [" + readySlot.Machine + "]\r\nTable: [" + readySlot.Table + "]\r\n站位: [" +
                                             readySlot.SlotName + "]\r\n边别: [" + (readySlot.Side == SideType.L ? "L" : "R") + "]";
                            }
                            else
                            {
                                resDto.Msg = "料卷已经发料";
                            }

                            throw new LYException(resDto.Msg);
                        }

                        // 查询挑料明细行数据
                        var readyBillD = await _repositoryReadyMBilld.FirstOrDefaultAsync(sendtemp.ReadyMBillDetailedId);

                        // 改变发料状态
                        sendtemp.IsSend = true;

                        // 添加发料数量
                        readyBillD.SendQty += reel.Qty;

                        // 改变料盘备料关联
                        reel.ReadyMBillDetailedId = readyBillD.Id;
                        reel.ReadyMBillId         = readyBillD.ReadyMBillId;

                        // 改变物料料站表绑定
                        reel.SlotId = sendtemp.SlotId;

                        // 改变日志备料关联
                        reelMoveLog.ReadyMBillDetailedId = readyBillD.Id;
                        reelMoveLog.ReadyMBillId         = readyBillD.ReadyMBillId;
                        reelMoveLog.SlotId = sendtemp.SlotId;

                        // 灭灯
                        await GetShelfUp();

                        shelfUp.LightState = LightState.Off;

                        // 如果发料完成,删除临时表
                        if (_repositoryRST.GetAll().Where(r => r.ReReadyMBillId == sendtemp.ReReadyMBillId && r.IsSend == false).Count() == 1)
                        {
                            await _repositoryRST.DeleteAsync(r => r.ReReadyMBillId == sendtemp.ReReadyMBillId);
                        }

                        // 查询当前物料的站位信息
                        if (readySlot != null)
                        {
                            resDto.Msg = "站位信息: \r\n" + "面别: [" + (readySlot.BoardSide == SideType.B ? "S" : "C") + "]\r\n机器: [" + readySlot.Machine + "]\r\nTable: [" + readySlot.Table + "]\r\n站位: [" +
                                         readySlot.SlotName + "]\r\n边别: [" + (readySlot.Side == SideType.L ? "L" : "R") + "]";
                        }
                        else
                        {
                            resDto.Msg = "发料成功";
                        }

                        var readyMs = await _repositoryReadyMBill.GetAll().Where(r => r.ReReadyMBillId == sendtemp.ReReadyMBillId).ToListAsync();

                        var readyMss = readyMs.Select(r => r.Id);

                        var readyMBs = await _repositoryReadyMBilld.GetAll().Where(r => readyMss.Contains(r.ReadyMBillId))
                                       .Select(r => new { r.PartNoId, r.Qty, r.SendQty, r.ReturnQty })
                                       .ToListAsync();

                        if (readyMBs.GroupBy(r => r.PartNoId).Select(r => new { r.Key, Qty = r.Sum(s => s.SendQty) - r.Sum(s => s.Qty) }).Where(r => r.Qty < 0).Count() == 1)
                        {
                            foreach (var item in readyMs)
                            {
                                item.ReadyMStatus = ReadyMStatus.Finish;
                            }
                        }

                        // 如果为首料进行小车闪灯
                        if (sendtemp.FisrtStorageLocationId != null && sendtemp.FisrtStorageLocationId.Length > 0)
                        {
                            var shelfF = await _repositorysl.FirstOrDefaultAsync(sendtemp.FisrtStorageLocationId);

                            StorageLight storage = new StorageLight()
                            {
                                ContinuedTime  = 10,
                                LightOrder     = 2,
                                MainBoardId    = shelfF.MainBoardId,
                                RackPositionId = shelfF.PositionId,
                                LightColor     = shelfF.LightColor
                            };
                            LightService.LightOrder(new List <StorageLight>()
                            {
                                storage
                            });
                        }

                        // 灭小灯和塔灯
                        LightService.LightOrder(new List <StorageLight>()
                        {
                            new StorageLight()
                            {
                                ContinuedTime  = 10,
                                LightOrder     = 0,
                                MainBoardId    = shelfUp.MainBoardId,
                                LightColor     = shelfUp.LightColor,
                                RackPositionId = shelfUp.PositionId
                            }
                        });

                        CurrentUnitOfWork.SaveChanges();
                        // 大灯 可能需要修改
                        var lights = _repositorysl.GetAll().Where(s => s.MainBoardId == shelfUp.MainBoardId && s.LightState != LightState.Off && s.LightColor == shelfUp.LightColor);
                        if (lights.Count() == 0)
                        {
                            LightService.HouseOrder(new List <HouseLight>()
                            {
                                new HouseLight()
                                {
                                    HouseLightSide = 1,
                                    LightOrder     = 0,
                                    LightColor     = shelfUp.LightColor,
                                    MainBoardId    = shelfUp.MainBoardId
                                }
                            });
                        }

                        #endregion
                        break;

                    case AllocationType.Return:         // 退料
                        // 查询最近的发料日志
                        var sendLog = await _repositoryReelMoveLog.GetAll().Where(r => r.IsActive && r.ReelId == reel.Id && r.ReadyMBillDetailedId != null).OrderByDescending(r => r.CreationTime).FirstOrDefaultAsync();

                        if (sendLog != null)
                        {
                            var readyBillDreturn = await _repositoryReadyMBilld.FirstOrDefaultAsync(sendLog.ReadyMBillDetailedId);

                            if (sendLog != null)
                            {
                                readyBillDreturn.ReturnQty += inputDto.ReturnReelQty;
                                sendLog.IsActive            = false;
                            }
                        }

                        break;

                    case AllocationType.Received:         // 收料

                        #region 收料
                        var receiveId = await _repositoryrrb.FirstOrDefaultAsync(r => r.PartNoId == reel.PartNoId && r.Qty > r.ReceivedQty && r.IQCCheckId == inputDto.IQCCheckId);

                        if (receiveId == null)
                        {
                            resDto.Msg = "当前ERP没有足够的IQC检验单,请确认";
                            throw new LYException(resDto.Msg);
                        }

                        receiveId.ReceivedQty += reel.Qty;
                        if (receiveId.ReceivedQty == receiveId.Qty)
                        {
                            receiveId.IsActive = true;
                        }
                        reel.ReceivedReelBillId        = receiveId.Id;
                        reelMoveLog.ReceivedReelBillId = receiveId.Id;
                        #endregion
                        break;

                    case AllocationType.Register:         // 注册
                        break;

                    case AllocationType.SendFirstReel:         // 发首料
                        break;

                    case AllocationType.SupplyReel:         // 补料
                        #region 补料
                        // 检测补料料临时表里面有没有该数据
                        var supplytemp = await _repositoryReelSupplyTemp.FirstOrDefaultAsync(reel.Id);

                        if (supplytemp == null)
                        {
                            resDto.Msg = "料卷未被挑料";
                            throw new LYException(resDto.Msg);
                        }

                        if (supplytemp.IsSend)
                        {
                            resDto.Msg = @"料卷已经发料    " + supplytemp.FisrtStorageLocationId;
                            throw new LYException(resDto.Msg);
                        }

                        // 查询挑料明细行数据
                        var readyBillDSupply = await _repositoryReadyMBilld.FirstOrDefaultAsync(supplytemp.ReadyMBillDetailedId);

                        // 改变发料状态
                        supplytemp.IsSend = true;

                        // 添加发料数量
                        readyBillDSupply.SendQty += reel.Qty;

                        // 查询挑料料站表行数据
                        var readySlotSupply = await _repositorySlot.FirstOrDefaultAsync(readyBillDSupply.SlotId);

                        // 改变料盘备料关联
                        reel.ReadyMBillDetailedId = readyBillDSupply.Id;
                        reel.ReadyMBillId         = readyBillDSupply.ReadyMBillId;

                        // 改变物料料站表绑定
                        reel.SlotId = supplytemp.SlotId;

                        // 改变日志备料关联
                        reelMoveLog.ReadyMBillDetailedId = readyBillDSupply.Id;
                        reelMoveLog.ReadyMBillId         = readyBillDSupply.ReadyMBillId;
                        reelMoveLog.SlotId = supplytemp.SlotId;
                        await GetShelfUp();

                        // 灭灯
                        shelfUp.LightState = LightState.Off;

                        if (readySlotSupply != null)
                        {
                            resDto.Msg = "站位信息: \r\n" + "面别: [" + (readySlotSupply.BoardSide == SideType.B ? "S" : "C") + "]\r\n机器: [" + readySlotSupply.Machine + "]\r\nTable: [" + readySlotSupply.Table + "]\r\n站位: [" +
                                         readySlotSupply.SlotName + "]\r\n边别: [" + (readySlotSupply.Side == SideType.L ? "L" : "R") + "]";
                        }
                        else
                        {
                            resDto.Msg = "发料成功";
                        }


                        // 灭小灯和塔灯
                        LightService.LightOrder(new List <StorageLight>()
                        {
                            new StorageLight()
                            {
                                ContinuedTime = 10, LightColor = shelfUp.LightColor, LightOrder = 0, MainBoardId = shelfUp.MainBoardId, RackPositionId = shelfUp.PositionId
                            }
                        });

                        CurrentUnitOfWork.SaveChanges();
                        // 大灯 可能需要修改
                        var lightssupply = _repositorysl.GetAll().Where(s => s.MainBoardId == shelfUp.MainBoardId && s.LightState != LightState.Off && s.LightColor == shelfUp.LightColor);
                        if (lightssupply.Count() == 0)
                        {
                            LightService.HouseOrder(new List <HouseLight>()
                            {
                                new HouseLight()
                                {
                                    HouseLightSide = 1, LightOrder = 0, MainBoardId = shelfUp.MainBoardId, LightColor = shelfUp.LightColor
                                }
                            });
                        }

                        #endregion
                        break;

                    case AllocationType.UpByShelf:         // 按库位下架
                        break;

                    default:
                        break;
                    }


                    break;

                case AllocationType.UpByShelf:

                    #region  库位下架
                    if (inputDto.ShlefLab == null || inputDto.ShlefLab.Length == 0)
                    {
                        inputDto.ShlefLab = inputDto.BarCode;
                    }

                    // 找到库位物料
                    var shelfL = _repositorysl.FirstOrDefault(inputDto.ShlefLab);
                    if (shelfL == null)
                    {
                        throw new LYException(1, "库位[" + inputDto.ShlefLab + "]不存在");
                    }

                    if (shelfL.ReelId == null)
                    {
                        throw new LYException(1, "库位[" + inputDto.ShlefLab + "]上无料");
                    }

                    // 查询库位上 reel
                    reel                   = _repository.FirstOrDefault(shelfL.ReelId);
                    shelfL.ReelId          = null;
                    reel.StorageLocationId = null;
                    reelMoveLog.ReelId     = reel.Id;
                    reelMoveLog.PartNoId   = reel.PartNoId;
                    reelMoveLog.Qty        = reel.Qty;
                    LightService.LightOrder(new List <StorageLight>()
                    {
                        new StorageLight()
                        {
                            ContinuedTime  = 10,
                            LightOrder     = 0,
                            MainBoardId    = shelfL.MainBoardId,
                            LightColor     = shelfL.LightColor,
                            RackPositionId = shelfL.PositionId
                        }
                    });
                    #endregion
                    break;

                case AllocationType.Register:

                    #region  料卷注册
                    // 查询料号是否已经维护
                    await BarCodeAnalysis();

                    reel = _repository.FirstOrDefault(reelDto.Id);

                    if (reel == null)
                    {
                        await CheckMPN();

                        // 刚注册物料不能被禁用
                        reelDto.IsActive = true;
                        reel             = ObjectMapper.Map <Reel>(reelDto);

                        // 直接进入注册仓库
                        reel.StorageId = reelMpn.RegisterStorageId;
                        reel           = await _repository.InsertAsync(reel);


                        // 进行注册,注册后立马保存料盘信息
                        await CurrentUnitOfWork.SaveChangesAsync();
                    }

                    reelMoveLog.ReelId   = reel.Id;
                    reelMoveLog.PartNoId = reel.PartNoId;
                    reelMoveLog.Qty      = reel.Qty;
                    #endregion
                    break;

                case AllocationType.Out:
                    #region 出库
                    if (reel == null)         // 进行料卷检查
                    {
                        await CheckReel();
                    }

                    if (reel.StorageLocationId != null)
                    {
                        await GetShelfUp();

                        shelfUp.ReelId = null;
                    }
                    await _repository.DeleteAsync(reel);

                    #endregion
                    break;

                default:
                    break;
                }
            }
            reelMoveLog.ReelInfo = Newtonsoft.Json.JsonConvert.SerializeObject(reel);
            // 最后插入调拨日志
            await _repositoryReelMoveLog.InsertAsync(reelMoveLog);

            resDto.Reel = ObjectMapper.Map <ReelDto>(reel);

            if (inputDto.ReturnReelQty > 0)
            {
                reel.Qty        = inputDto.ReturnReelQty;
                resDto.Reel.Qty = inputDto.ReturnReelQty;
            }

            return(resDto);
        }
 public CCMPNValue(string mpnName, int v, int min, int max) {
     this.name = (MPN)Enum.Parse(typeof(MPN), mpnName);
     this.value = v;
     this.min = min;
     this.max = max;
 }
Ejemplo n.º 31
0
 // Token: 0x060001B0 RID: 432 RVA: 0x0001031C File Offset: 0x0000E51C
 public CCMPN(MPN name, string filename)
 {
     this.name     = name;
     this.filename = filename;
 }
 public CCMPN(string mpnName, string filename) {
     this.name = (MPN)Enum.Parse(typeof(MPN), mpnName);
     this.filename = filename;
 }
Ejemplo n.º 33
0
        public static bool IsWear(MPN mpn)
        {
            var mpnNo = (int)mpn;

            return(WEAR_START <= mpnNo && mpnNo <= WEAR_END);
        }
Ejemplo n.º 34
0
    public static int gcd(int[] x, int[] y, int len)
    {
        int i, word;

        for (i = 0; ; i++)
        {
            word = x[i] | y[i];
            if (word != 0)
            {
                break;
            }
        }
        int initShiftWords = i;
        int initShiftBits  = findLowestBit(word);

        len -= initShiftWords;
        MPN.rshift0(x, x, initShiftWords, len, initShiftBits);
        MPN.rshift0(y, y, initShiftWords, len, initShiftBits);
        int[] odd_arg;
        int[] other_arg;
        if ((x[0] & 1) != 0)
        {
            odd_arg   = x;
            other_arg = y;
        }
        else
        {
            odd_arg   = y;
            other_arg = x;
        }
        for (;;)
        {
            for (i = 0; other_arg[i] == 0;)
            {
                i++;
            }
            if (i > 0)
            {
                int j;
                for (j = 0; j < len - i; j++)
                {
                    other_arg[j] = other_arg[j + i];
                }
                for (; j < len; j++)
                {
                    other_arg[j] = 0;
                }
            }
            i = findLowestBit(other_arg[0]);
            if (i > 0)
            {
                MPN.rshift(other_arg, other_arg, 0, len, i);
            }
            i = MPN.cmp(odd_arg, other_arg, len);
            if (i == 0)
            {
                break;
            }
            if (i > 0)
            {
                MPN.sub_n(odd_arg, odd_arg, other_arg, len);
                int[] tmp = odd_arg;
                odd_arg   = other_arg;
                other_arg = tmp;
            }
            else
            {
                MPN.sub_n(other_arg, other_arg, odd_arg, len);
            } while (odd_arg[len - 1] == 0 && other_arg[len - 1] == 0)
            {
                len--;
            }
        }
        if (initShiftWords + initShiftBits > 0)
        {
            if (initShiftBits > 0)
            {
                int sh_out = MPN.lshift(x, initShiftWords, x, len, initShiftBits);
                if (sh_out != 0)
                {
                    x[(len++) + initShiftWords] = sh_out;
                }
            }
            else
            {
                for (i = len; --i >= 0;)
                {
                    x[i + initShiftWords] = x[i];
                }
            }
            for (i = initShiftWords; --i >= 0;)
            {
                x[i] = 0;
            }
            len += initShiftWords;
        }
        return(len);
    }
 public static bool IsBody(MPN mpn) {
     int mpnNo = (int)mpn;
     return  (mpnNo >= BODY_START && mpnNo <= BODY_END);
 }
 public CCMPN(MPN name, string filename) {
     this.name = name;
     this.filename = filename;
 }
Ejemplo n.º 37
0
            public void UpdateMenus(MPN category)
            {
                buttons.Clear();
                List <MenuInfo> existing;

                if (!Menus.TryGetValue(category, out existing))
                {
                    return;
                }

                foreach (MenuInfo menu in existing)
                {
                    try{
                        if (menu != null)
                        {
                            if (menu.delOnly)
                            {
                                continue;
                            }

                            if (menu.partCategory == category)
                            {
                                Texture2D iconTexture = AssetLoader.LoadTexture(menu.iconTextureName);
                                if (iconTexture == null)
                                {
                                    iconTexture = new Texture2D(1, 1);
                                    iconTexture.SetPixel(0, 0, new Color32(1, 1, 1, 1));
                                    iconTexture.Apply();
                                }
                                CustomTextureButton button = new CustomTextureButton(iconTexture);
                                if (menu.modelName == null)
                                {
                                    continue;
                                }
                                string modelName = String.Copy(menu.modelName);

                                button.Text = modelName;

                                string modelIconName;
                                if (menu.iconTextureName != null)
                                {
                                    modelIconName = String.Copy(menu.iconTextureName);
                                }
                                else
                                {
                                    modelIconName = "";
                                }

                                MenuInfo menuCopy = new MenuInfo(menu);
                                button.Click += (o, e) => func(menuCopy);
                                buttons.Add(button);
                            }
                        }
                        else
                        {
                            Debug.LogError("Null MenuInfo");
                        }
                    }
                    catch
                    {
                        // Debug.LogError( e );
                    }
                }
            }
 public static bool IsWear(MPN mpn) {
     int mpnNo = (int)mpn;
     return  (mpnNo >= WEAR_START && mpnNo <= WEAR_END);
 }