Exemple #1
0
        public void DataLoad(string packNo, string bu, OleExec sfcdb, DB_TYPE_ENUM DBType)
        {
            List <string>  itemList       = new List <string>();
            T_C_SKU        t_c_sku        = new T_C_SKU(sfcdb, DBType);
            T_R_PACKING    t_r_packing    = new T_R_PACKING(sfcdb, DBType);
            T_R_SN_PACKING t_r_sn_packing = new T_R_SN_PACKING(sfcdb, DBType);
            T_R_SN         t_r_sn         = new T_R_SN(sfcdb, DBType);
            T_C_PACKING    t_c_packing    = new T_C_PACKING(sfcdb, DBType);
            R_PACKING      packing        = new R_PACKING();
            C_SKU          sku            = new C_SKU();
            Packing        packObject     = new Packing();
            C_PACKING      c_packing      = new C_PACKING();

            packing = t_r_packing.GetRPackingByPackNo(sfcdb, packNo).GetDataObject();
            sku     = t_c_sku.GetSku(packing.SKUNO, sfcdb, DBType).GetDataObject();
            if (packing.PACK_TYPE == LogicObject.PackType.PALLET.ToString().ToUpper())
            {
                c_packing = t_c_packing.GetPackingBySkuAndType(sku.SKUNO, LogicObject.PackType.CARTON.ToString().ToUpper(), sfcdb);
                if (c_packing.MAX_QTY == 1 && bu.ToUpper().Equals("VERTIV"))
                {
                    //VERTIV 當卡通包規為1時,調棧板顯示卡通內的SN
                    itemList = t_r_packing.GetPakcingSNList(packing.ID, sfcdb);
                }
                else
                {
                    List <R_PACKING> packingList = t_r_packing.GetListPackByParentPackId(packing.ID, sfcdb);
                    foreach (R_PACKING pack in packingList)
                    {
                        itemList.Add(pack.PACK_NO);
                    }
                }
            }
            else if (packing.PACK_TYPE == LogicObject.PackType.CARTON.ToString().ToUpper())
            {
                List <Row_R_SN_PACKING> snPackingList = t_r_sn_packing.GetPackItem(packing.ID, sfcdb);
                foreach (Row_R_SN_PACKING sn in snPackingList)
                {
                    itemList.Add(t_r_sn.GetById(sn.SN_ID, sfcdb).SN);
                }
            }
            this.PackID       = packing.ID;
            this.PackNo       = packing.PACK_NO;
            this.PackType     = packing.PACK_TYPE;
            this.ParentPackID = packing.PARENT_PACK_ID;
            this.Skuno        = packing.SKUNO;
            this.SkunoVer     = sku.VERSION;
            this.MaxQty       = packing.MAX_QTY;
            this.Qty          = packing.QTY;
            this.ClosedFlag   = packing.CLOSED_FLAG;
            this.CreatTime    = packing.CREATE_TIME;
            this.EditTime     = packing.EDIT_TIME;
            this.EditEmp      = packing.EDIT_EMP;
            this.Line         = packing.LINE;
            this.Station      = packing.STATION;
            this.IP           = packing.IP;
            this.PackList     = itemList;
        }
Exemple #2
0
        /// <summary>
        /// 檢查棧板或卡通中SN是否已出貨
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckSnIsShippedByCartonOrPallet(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

            MESStationSession sessionPackObject = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionPackObject == null || sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }

            R_PACKING packObject = Station.SFCDB.ORM.Queryable <R_PACKING>().Where(p => p.PACK_NO == sessionPackObject.Value.ToString()).ToList().FirstOrDefault();

            if (packObject != null)
            {
                List <R_SN> snList      = new List <R_SN>();
                T_R_PACKING t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);
                string      strSnList   = "";
                if (packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    snList = t_r_packing.GetSnListByPalletID(packObject.ID, Station.SFCDB);
                }
                else if (packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    snList = t_r_packing.GetSnListByCartonID(packObject.ID, Station.SFCDB);
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529094259", new string[] { }));
                }

                foreach (R_SN sn in snList)
                {
                    strSnList += sn.SN + ",";
                }
                if (snList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180808142945", new string[] { packObject.PACK_NO, snList.Count().ToString(), strSnList }));
                }
                if (snList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180808141806", new string[] { packObject.PACK_NO, snList.Count().ToString(), strSnList }));
                }
            }
            else
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613093329", new string[] { sessionPackObject.Value.ToString() }));
            }
        }
Exemple #3
0
        /// <summary>
        /// 檢查棧板或卡通中SN是否有被鎖定
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void MovePackCheckSnStatusIsLock(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

            MESStationSession sessionPackObject = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionPackObject == null || sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            R_PACKING packObject = Station.SFCDB.ORM.Queryable <R_PACKING>().Where(p => p.PACK_NO == sessionPackObject.Value.ToString()).ToList().FirstOrDefault();

            if (packObject != null)
            {
                T_R_SN_LOCK      tRSnLock    = new T_R_SN_LOCK(Station.SFCDB, Station.DBType);
                List <R_SN_LOCK> rSnLockList = new List <R_SN_LOCK>();
                string           strSnList   = "";
                if (packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    rSnLockList = tRSnLock.GetLockListByPackNo(packObject.PACK_NO, Station.SFCDB);
                }
                else if (packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    rSnLockList = tRSnLock.GetLockListByCartonNo(packObject.PACK_NO, Station.SFCDB);
                }
                else
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180529094259", new string[] { }));
                }

                foreach (R_SN_LOCK snLock in rSnLockList)
                {
                    strSnList += snLock.SN + ",";
                }
                if (rSnLockList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.PALLET.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180531114237", new string[] { packObject.PACK_NO, rSnLockList.Count().ToString(), strSnList }));
                }
                if (rSnLockList.Count > 0 && packObject.PACK_TYPE == LogicObject.PackType.CARTON.ToString())
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180808141643", new string[] { packObject.PACK_NO, rSnLockList.Count().ToString(), strSnList }));
                }
            }
            else
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613093329", new string[] { sessionPackObject.Value.ToString() }));
            }
        }
Exemple #4
0
        /// <summary>
        /// 移棧板或卡通內的數據
        /// add by fgg 2018.06.08
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void MovePackingSessionValue(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 8)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

            MESStationSession sessionOne = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionOne == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionOne.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }

            MESStationSession sessionTwo = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (sessionTwo == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }
            if (sessionTwo.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

            MESStationSession sessionValue = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (sessionValue == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }
            if (sessionValue.Value.ToString() == "")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }

            MESStationSession sessionItemListOne = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (sessionItemListOne == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }));
            }

            MESStationSession sessionItemListTwo = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (sessionItemListTwo == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY }));
            }

            MESStationSession sessionCountOne = Station.StationSession.Find(t => t.MESDataType == Paras[5].SESSION_TYPE && t.SessionKey == Paras[5].SESSION_KEY);

            if (sessionCountOne == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[5].SESSION_TYPE + Paras[5].SESSION_KEY }));
            }

            MESStationSession sessionCountTwo = Station.StationSession.Find(t => t.MESDataType == Paras[6].SESSION_TYPE && t.SessionKey == Paras[6].SESSION_KEY);

            if (sessionCountTwo == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[6].SESSION_TYPE + Paras[6].SESSION_KEY }));
            }

            R_Station_Action_Para moveFlag = Paras[7];

            bool moveToRight;

            if (moveFlag.VALUE.ToString().Equals("0"))
            {
                moveToRight = true;
            }
            else if (moveFlag.VALUE.ToString().Equals("1"))
            {
                moveToRight = false;
            }
            else
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[7].SESSION_TYPE + Paras[7].SESSION_KEY }));
            }

            try
            {
                LogicObject.Packing packOne        = (LogicObject.Packing)sessionOne.Value;;
                LogicObject.Packing packTwo        = (LogicObject.Packing)sessionTwo.Value;;
                string              result         = "";
                T_R_PACKING         t_r_packing    = new T_R_PACKING(Station.SFCDB, Station.DBType);
                T_R_SN_PACKING      t_r_sn_packing = new T_R_SN_PACKING(Station.SFCDB, Station.DBType);
                T_R_SN              t_r_sn         = new T_R_SN(Station.SFCDB, Station.DBType);
                T_R_MOVE_LIST       t_r_move_list  = new T_R_MOVE_LIST(Station.SFCDB, Station.DBType);
                T_C_PACKING         t_c_packing    = new T_C_PACKING(Station.SFCDB, Station.DBType);
                LogicObject.Packing packOneObject  = new LogicObject.Packing();
                LogicObject.Packing packTwoObject  = new LogicObject.Packing();
                R_SN            r_sn;
                Row_R_MOVE_LIST rowMoveList;
                Row_R_PACKING   rowPacking;
                C_PACKING       c_packing = new C_PACKING();
                if (packOne.ClosedFlag == "0")
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613090152", new string[] { packOne.PackNo }));
                }
                if (packTwo.ClosedFlag == "0")
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613090152", new string[] { packTwo.PackNo }));
                }
                if (!packOne.PackType.Equals(packTwo.PackType))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612114250", new string[] { packOne.PackNo, packTwo.PackNo }));
                }
                if (!packOne.Skuno.Equals(packTwo.Skuno))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141141", new string[] { packOne.PackNo, packTwo.PackNo }));
                }
                if (!packOne.SkunoVer.Equals(packTwo.SkunoVer))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141356", new string[] { packOne.PackNo, packTwo.PackNo }));
                }

                Newtonsoft.Json.Linq.JArray moveValueArray = (Newtonsoft.Json.Linq.JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(sessionValue.Value.ToString());

                if (packOne.PackType == LogicObject.PackType.PALLET.ToString().ToUpper())
                {
                    for (int i = 0; i < moveValueArray.Count; i++)
                    {
                        c_packing = t_c_packing.GetPackingBySkuAndType(packTwo.Skuno, LogicObject.PackType.CARTON.ToString().ToUpper(), Station.SFCDB);
                        if (c_packing.MAX_QTY == 1 && Station.BU.ToUpper().Equals("VERTIV"))
                        {
                            //更新棧板號
                            //VERTIV 當卡通包規為1時,調棧板顯示卡通內的SN,故更新信息另外處理
                            R_PACKING packingObjectTemp = t_r_packing.GetPackingObjectBySN(moveValueArray[i].ToString(), Station.SFCDB);
                            if (packingObjectTemp == null)
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180620114012", new string[] { moveValueArray[i].ToString() }));
                            }
                            if (!t_r_packing.CheckPackNoExistByParentPackID(packingObjectTemp.PACK_NO, packOne.PackID, Station.SFCDB))
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141600", new string[] { moveValueArray[i].ToString(), packOne.PackNo }));
                            }
                            if (t_r_packing.CheckPackNoExistByParentPackID(packingObjectTemp.PACK_NO, packTwo.PackID, Station.SFCDB))
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141824", new string[] { moveValueArray[i].ToString(), packTwo.PackNo }));
                            }
                            result     = t_r_packing.UpdateParentPackIDByPackNo(packingObjectTemp.PACK_NO, packTwo.PackID, Station.LoginUser.EMP_NO, Station.SFCDB);
                            rowPacking = t_r_packing.GetRPackingByPackNo(Station.SFCDB, packingObjectTemp.PACK_NO);
                        }
                        else
                        {
                            if (!t_r_packing.CheckPackNoExistByParentPackID(moveValueArray[i].ToString(), packOne.PackID, Station.SFCDB))
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141600", new string[] { moveValueArray[i].ToString(), packOne.PackNo }));
                            }
                            if (t_r_packing.CheckPackNoExistByParentPackID(moveValueArray[i].ToString(), packTwo.PackID, Station.SFCDB))
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141824", new string[] { moveValueArray[i].ToString(), packTwo.PackNo }));
                            }
                            //更新棧板號
                            result     = t_r_packing.UpdateParentPackIDByPackNo(moveValueArray[i].ToString(), packTwo.PackID, Station.LoginUser.EMP_NO, Station.SFCDB);
                            rowPacking = t_r_packing.GetRPackingByPackNo(Station.SFCDB, moveValueArray[i].ToString());
                        }
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_PACKING" }));
                        }
                        result = t_r_packing.UpdateQtyByID(packTwo.PackID, true, 1, Station.LoginUser.EMP_NO, Station.SFCDB);
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_PACKING" }));
                        }
                        result = t_r_packing.UpdateQtyByID(packOne.PackID, false, 1, Station.LoginUser.EMP_NO, Station.SFCDB);
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_PACKING" }));
                        }
                        //寫入記錄

                        rowMoveList               = (Row_R_MOVE_LIST)t_r_move_list.NewRow();
                        rowMoveList.ID            = t_r_move_list.GetNewID(Station.BU, Station.SFCDB);
                        rowMoveList.MOVE_ID       = rowPacking.ID;
                        rowMoveList.FROM_LOCATION = packOne.PackID;
                        rowMoveList.TO_LOCATION   = packTwo.PackID;
                        rowMoveList.PACK_TYPE     = packOne.PackType;
                        rowMoveList.MOVE_EMP      = Station.LoginUser.EMP_NO;
                        rowMoveList.MOVE_DATE     = Station.GetDBDateTime();
                        result = Station.SFCDB.ExecSQL(rowMoveList.GetInsertString(Station.DBType));
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "R_MOVE_LIST" }));
                        }
                    }
                }
                else if (packOne.PackType == LogicObject.PackType.CARTON.ToString().ToUpper())
                {
                    for (int i = 0; i < moveValueArray.Count; i++)
                    {
                        r_sn = new R_SN();
                        r_sn = t_r_sn.GetDetailBySN(moveValueArray[i].ToString(), Station.SFCDB);
                        if (!t_r_sn_packing.CheckSNExistByPackID(r_sn.ID, packOne.PackID, Station.SFCDB))
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141600", new string[] { moveValueArray[i].ToString(), packOne.PackNo }));
                        }
                        if (t_r_sn_packing.CheckSNExistByPackID(r_sn.ID, packTwo.PackID, Station.SFCDB))
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612141824", new string[] { moveValueArray[i].ToString(), packTwo.PackNo }));
                        }
                        //更新卡通號
                        result = t_r_sn_packing.UpdatePackIDBySnID(r_sn.ID, packTwo.PackID, Station.LoginUser.EMP_NO, Station.SFCDB);
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_SN_PACKING" }));
                        }

                        result = t_r_packing.UpdateQtyByID(packTwo.PackID, true, 1, Station.LoginUser.EMP_NO, Station.SFCDB);
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_PACKING" }));
                        }
                        result = t_r_packing.UpdateQtyByID(packOne.PackID, false, 1, Station.LoginUser.EMP_NO, Station.SFCDB);
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "R_PACKING" }));
                        }

                        //寫入記錄
                        rowMoveList               = (Row_R_MOVE_LIST)t_r_move_list.NewRow();
                        rowMoveList.ID            = t_r_move_list.GetNewID(Station.BU, Station.SFCDB);
                        rowMoveList.MOVE_ID       = r_sn.ID;
                        rowMoveList.FROM_LOCATION = packOne.PackID;
                        rowMoveList.TO_LOCATION   = packTwo.PackID;
                        rowMoveList.PACK_TYPE     = packOne.PackType;
                        rowMoveList.MOVE_EMP      = Station.LoginUser.EMP_NO;
                        rowMoveList.MOVE_DATE     = Station.GetDBDateTime();
                        result = Station.SFCDB.ExecSQL(rowMoveList.GetInsertString(Station.DBType));
                        if (Convert.ToInt32(result) == 0)
                        {
                            throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "R_MOVE_LIST" }));
                        }
                    }
                }
                else
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180607163531", new string[] { "Pack:" + packOne.PackType }));
                }
                //關閉卡通或棧板
                result = t_r_packing.UpdateCloseFlagByPackID(packOne.PackID, "1", Station.SFCDB);
                if (Convert.ToInt32(result) == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612154506", new string[] { packOne.PackNo }));
                }
                //關閉卡通或棧板
                result = t_r_packing.UpdateCloseFlagByPackID(packTwo.PackID, "1", Station.SFCDB);
                if (Convert.ToInt32(result) == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612154506", new string[] { packTwo.PackNo }));
                }

                packOneObject.DataLoad(packOne.PackNo, Station.BU, Station.SFCDB, Station.DBType);
                packTwoObject.DataLoad(packTwo.PackNo, Station.BU, Station.SFCDB, Station.DBType);
                sessionOne.Value = packOneObject;
                sessionTwo.Value = packTwoObject;
                if (moveToRight)
                {
                    sessionItemListOne.Value = packOneObject.PackList;
                    sessionItemListTwo.Value = packTwoObject.PackList;
                    sessionCountOne.Value    = packOneObject.PackList.Count;
                    sessionCountTwo.Value    = packTwoObject.PackList.Count;
                }
                else
                {
                    sessionItemListOne.Value = packTwoObject.PackList;
                    sessionItemListTwo.Value = packOneObject.PackList;
                    sessionCountOne.Value    = packTwoObject.PackList.Count;
                    sessionCountTwo.Value    = packOneObject.PackList.Count;
                }
                Station.StationMessages.Add(new StationMessage()
                {
                    Message = MESReturnMessage.GetMESReturnMessage("MSGCODE20180612142034", new string[] { packOne.PackNo.ToString(), moveValueArray.Count.ToString(), packTwo.PackNo.ToString() }),
                    State   = StationMessageState.Pass
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }