public IList <CV_MM_LOTS_EXT> getLotsEntity(CV_MM_LOTS_EXT_QueryParam entity)
        {
            IList <CV_MM_LOTS_EXT> list = new List <CV_MM_LOTS_EXT>();

            list = LotsExtBO.GetEntities(entity);
            //log.Debug(JsonConvert.SerializeObject(list));
            return(list);
        }
Ejemplo n.º 2
0
        public IList <CV_PM_SMT_RECEIPE_DETAIL> checkAgain(CV_PM_SMT_RECEIPE_DETAIL_QueryParam Entitie)
        {
            bool isFinishedAll = true;
            IList <CV_PM_SMT_ReceipeDetailSetup> detaillist    = new List <CV_PM_SMT_ReceipeDetailSetup>();
            CV_MM_LOTS_EXT_QueryParam            lotqp         = new CV_MM_LOTS_EXT_QueryParam();
            IList <CV_MM_LOTS_EXT>                  lotList    = new List <CV_MM_LOTS_EXT>();
            IList <CV_PM_SMT_RECEIPE_DETAIL>        cvfourList = new List <CV_PM_SMT_RECEIPE_DETAIL>();
            CV_PM_SMT_ReceipeDetailSetup_QueryParam sanQP      = new CV_PM_SMT_ReceipeDetailSetup_QueryParam();

            sanQP.Slot      = Entitie.Slot;
            sanQP.OrderID   = Entitie.OrderID;
            sanQP.MachineID = Entitie.MachineID;
            sanQP.PcbSide   = Entitie.PcbSide;
            detaillist      = CV_PM_SMT_ReceipeDetailSetupBO.GetEntities(sanQP);

            ////在视图中查
            //lotqp.LotID = Entitie.LotID;
            //lotqp.OrderID = Entitie.OrderID;
            //lotList = CV_MM_LOTS_EXTBO.GetEntities(lotqp);
            //if (lotList.Count == 0)
            //{
            //    cvfourList.Clear();
            //    return cvfourList;
            //}

            //if (lotList[0].DefID != detaillist[0].MaterialID) //条码是否存在,必须由WMS导入MES
            //{
            //    cvfourList.Clear();
            //    return cvfourList;
            //}
            LES_REQUEST_RECEIVE receive = new LES_REQUEST_RECEIVE();

            receive.HutID = Entitie.LotID;
            IList <LES_REQUEST_RECEIVE> detailPKList = receiveBO.GetEntities(receive);

            if (detailPKList == null || detailPKList.Count == 0 || detailPKList[0].OrderID != Entitie.OrderID || detailPKList[0].MaterialID != detaillist[0].MaterialID)//核对工单、物料
            {
                cvfourList.Clear();
                return(cvfourList);
            }
            receive.ReceivePK = detailPKList[0].ReceivePK;
            //hutID对应的接料信息,调wms接口用
            LESReceive lesReceive = new LESReceive();

            lesReceive.HutID         = receive.HutID;
            lesReceive.DetailPK      = Convert.ToInt32(detailPKList[0].DetailPK);
            lesReceive.OperationTime = SSGlobalConfig.Now;
            lesReceive.Operator      = Entitie.UpdatedBy;
            lesReceive.ReceivePK     = (int)detailPKList[0].ReceivePK;
            lesReceive.IsLastHut     = Convert.ToBoolean(detailPKList[0].IsLastHut);

            LES_REQUEST_DETAIL lesDetail = lesDetailBO.GetEntity(Convert.ToInt32(detailPKList[0].DetailPK));

            if (lesDetail == null)
            {
                cvfourList.Clear();
                return(cvfourList);
            }
            lesReceive.RequestPK = (int)lesDetail.RequestPK;

            PM_SMT_RECEIPE_SETUP_DETAIL         detail    = new PM_SMT_RECEIPE_SETUP_DETAIL();
            PM_SMT_RECEIPE_SETUP_DETAIL         detailQP  = new PM_SMT_RECEIPE_SETUP_DETAIL();
            CV_PM_SMT_RECEIPE_DETAIL_QueryParam cvFourQP  = new CV_PM_SMT_RECEIPE_DETAIL_QueryParam();
            PM_SMT_RECEIPE_SETUP_DETAIL         setDetail = new PM_SMT_RECEIPE_SETUP_DETAIL();

            setDetail.DetailPK = detaillist[0].DetailPK;
            //查询SetupDetailPK
            IList <PM_SMT_RECEIPE_SETUP_DETAIL> listSet = setupDetailBO.GetEntities(setDetail);

            if (listSet != null && listSet.Count != 0)
            {
                detail.SetupDetailPK = listSet[0].SetupDetailPK;
            }
            detail.DetailPK      = detaillist[0].DetailPK;
            detail.CfmedLotID    = Entitie.CfmedLotID;
            detail.SetupPK       = detaillist[0].SetupPK;
            detail.CfmedOperator = Entitie.UpdatedBy;
            detailQP.SetupPK     = detaillist[0].SetupPK;
            detailQP.DetailPK    = detaillist[0].DetailPK;
            detailQP.CfmedLotID  = Entitie.CfmedLotID;

            //防止二次添加。
            IList <PM_SMT_RECEIPE_SETUP_DETAIL> listCV = setupDetailBO.GetEntities(detailQP);

            if (listCV != null && listCV.Count != 0 && detail.SetupDetailPK != null)
            {
                if (listCV[0].CfmedLotID == null)
                {
//                    //调用存储过程
//                    string Sql = string.Format( //如果已存在会返回LocPK
//                            @"DECLARE	@return_value int,
//		                      @ReturnMessage nvarchar(1000)
//
//                             EXEC	@return_value = [dbo].[CP_LES_CheckReceiveMaterial_1.18]
//		                     @HutID = N'{0}',
//		                     @LotID = N'{0}',
//		                     @ReturnMessage = @ReturnMessage OUTPUT
//
//                             SELECT	@ReturnMessage as N'@ReturnMessage'", Entitie.LotID);
//                    DataTable exelist = null;
//                    exelist = co_BSC_BO.GetDataTableBySql(Sql);
//                    string result = exelist.Rows[0][0].ToString();
//                    if (result!="OK")   //realID校验不通过
//                    {
//                        return cvfourList;
//                    }
                    //调wms接口,二次核对同时接料
                    ReturnValue rv = new ReturnValue();
                    rv = API_WMS_BO.ReceiveMaterial(lesReceive);
                    if (rv.Success == false)
                    {
                        return(cvfourList);
                    }
                    //修改接料状态
                    string s = receiveBO.ModifyMaterialStatus(Entitie.UpdatedBy, Convert.ToInt32(receive.ReceivePK));
                    if (s.Contains("OK"))
                    {
                        detail.CfmedOperationTime = SSGlobalConfig.Now;
                        setupDetailBO.UpdateSome(detail);
                    }
                }
            }
            cvFourQP.RcpPK = detaillist[0].RcpPK;
            cvfourList     = cvReceipeDetailBO.GetEntities(cvFourQP);

            //检查是否扫描完毕。
            for (int i = 0; i < cvfourList.Count; i++)
            {
                if (cvfourList[i].CfmedLotID == null)
                {
                    isFinishedAll = false;
                    break;
                }
            }
            if (!isFinishedAll)
            {
                PM_SMT_RECEIPE_SETUP Setup = new PM_SMT_RECEIPE_SETUP();
                Setup.UpdatedBy   = Entitie.UpdatedBy;
                Setup.UpdatedOn   = SSGlobalConfig.Now;
                Setup.SetupPK     = cvfourList[0].SetupPK;
                Setup.SetupStatus = 4;
                ReceipeSetupBO.UpdateSome(Setup);
            }
            return(cvfourList);
        }