コード例 #1
0
ファイル: RegionManager.cs プロジェクト: wra222/testgit
 public void DeleteRegion(string region)
 {
     UnitOfWork unit = new UnitOfWork();
     modelRepository.DeleteModelInfoNameByRegionDefered(unit, region);
     partRepository.DeleteRegionByNameDefered(unit, region);
     unit.Commit();
 }
コード例 #2
0
 /// <summary>
 /// 根据type,defect删除一条数据
 /// </summary>
 /// <param name="type"></param>
 /// <param name="defect"></param>
 public void DeleteDefectCode(string type, string defect)
 {
     try
     {
         IDefectRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IDefectRepository>();
         int count = itemRepository.CheckExistsRecord(defect);
         if (count <= 0)
         {
             //已经不存在具有相同的defectCode记录
             List<string> erpara = new List<string>();
             FisException ex;
             ex = new FisException("DMT119", erpara);
             throw ex;
         }
         else
         {
             IUnitOfWork unitWork = new UnitOfWork();
             Defect defectInfo = itemRepository.Find(defect);
             itemRepository.Remove(defectInfo, unitWork);
             unitWork.Commit();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
ファイル: UpdateConsolidate.cs プロジェクト: wra222/testgit
        public ArrayList Update(string pdline, string station, string editor, string customer, string consolidate, string actqty)
        {
            try
            {
                ArrayList ret = new ArrayList();

                string newConsolidate = String.Empty;
                if (actqty.TrimEnd().Length == 1)
                {
                    newConsolidate = consolidate.TrimEnd() + "/ " + actqty.TrimEnd();
                }
                else
                {
                    newConsolidate = consolidate.TrimEnd() + "/" + actqty.TrimEnd();
                }
                
                IDeliveryRepository DeliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                UnitOfWork uow = new UnitOfWork();
                
                DeliveryRepository.InsertDeliveryAttrLogDefered(uow, newConsolidate, editor, consolidate);
                DeliveryRepository.UpdateDeliveryInfoValueByInfoTypeAndInfoValuePrefixDefered(uow, newConsolidate, "Consolidated", consolidate, editor);
                DeliveryRepository.UpdateConsolidateQtyInDeliveryExDefered(uow, consolidate, int.Parse(actqty.Trim()), editor);
                uow.Commit();
            
                return ret;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
        }
コード例 #4
0
ファイル: UpdateShipDate.cs プロジェクト: wra222/testgit
 /// <summary>
 /// 更改Delivery表相关信息
 /// </summary>
 /// <param name="dn">dn</param>
 /// <param name="dnDate">dnDate</param>
 /// <param name="editor">editor</param>
 public void UpDN(string dn, string dnDate, string editor)
 { 
     logger.Debug("(_UpdateShipDate)UpDN start.");
     DNUpdateCondition myCondition = new DNUpdateCondition();
     myCondition.DeliveryNo = dn;
     myCondition.ShipDate = DateTime.Parse(dnDate);
     try
     {
         UnitOfWork uow = new UnitOfWork();
         //currentRepository.UpdateDNByCondition( myCondition,  editor);
         currentRepository.UpdateDNByConditionDefered(uow, myCondition, editor);
         currentRepository.updateEDIPAKComnShipDateDefered(uow, dn, myCondition.ShipDate.ToString("yyyyMMdd"));
         uow.Commit();
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg, e);
         throw new Exception(e.mErrmsg);
     }
     catch (Exception e)
     {
         logger.Error(e.Message, e);
         throw new SystemException(e.Message);
     }
     finally
     {
         logger.Debug("(_UpdateShipDate)UpDN end.");
     }
 }
コード例 #5
0
ファイル: FAIModelRule.cs プロジェクト: wra222/testgit
        public void Delete(string idFamilyInfo, string editor)
        {
            string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}(idFamilyInfo={1})", methodName, idFamilyInfo);
            try
            {
                IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                FamilyInfoDef cond = new FamilyInfoDef();
                cond.id = int.Parse(idFamilyInfo);

                IUnitOfWork uow = new UnitOfWork();

                familyRep.RemoveFamilyInfoDefered(uow, cond);

                uow.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
        }
コード例 #6
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        public void AddCustomer(CustomerInfo customerInfo)
        {
            FisException ex;
            List<string> paraError = new List<string>();

            try
            {
                IMiscRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>();

                if (itemRepository.GetCustomerInfo(customerInfo.customer) == null)
                {
                    UnitOfWork uow = new UnitOfWork();
                    itemRepository.AddCustomerDefered(uow, customerInfo);
                    uow.Commit();
                }
                else
                {
                    ex = new FisException("DMT056", paraError);
                    throw ex;
                }
            }
            catch (Exception)
            {
                throw;
            }

        }
コード例 #7
0
ファイル: ShipTypeManager.cs プロジェクト: wra222/testgit
 //更新ShipType
 public void UpdateShipType(ShipTypeMaintain shipType, string oldShipType)
 {
     ShipType fisObject = new ShipType();
     fisObject.shipType = shipType.shipType;
     fisObject.Description = shipType.Description;
     fisObject.Editor = shipType.Editor;
     fisObject.Cdt = DateTime.Now;
     fisObject.Udt = DateTime.Now; 
     UnitOfWork uow = new UnitOfWork();
     modelRepository.DeleteShipTypeByKeyDefered(uow, oldShipType);
     modelRepository.InsertShipTypeDefered(uow, fisObject);
     uow.Commit();
 }
コード例 #8
0
ファイル: COAReceivingManager.cs プロジェクト: wra222/testgit
 public void SaveTXTIntoTmpTable(IList<IMES.DataModel.COAReceivingDef> dataLst)
 {
     try 
     {
         IUnitOfWork ow = new UnitOfWork();
         if(dataLst.Count>0)
         {
             COAReceivingDef def = dataLst[0];
             itemRepository.RemoveTmpTableItemDefered(ow,def.pc.Trim());
             IList<TmpTableInfo> voLst=PO2VO(dataLst);
             itemRepository.SaveTXTIntoTmpTableDefered(ow,voLst);
             ow.Commit();
         }
     }
     catch(Exception)
     {
         throw;
     }
 }
コード例 #9
0
ファイル: ModelProcessManager.cs プロジェクト: wra222/testgit
 public void ChangePriority(RulesetInfoDataMaintain highPriority, RulesetInfoDataMaintain lowPriority)
 {
     highPriority.Priority = highPriority.Priority + 1;
     lowPriority.Priority = lowPriority.Priority - 1;
     UnitOfWork uow = new UnitOfWork();
     ProcessRuleSet ruleset1 = new ProcessRuleSet();
     ruleset1.Cdt = highPriority.Cdt;
     ruleset1.Condition1 = highPriority.Condition1;
     ruleset1.Condition2 = highPriority.Condition2;
     ruleset1.Condition3 = highPriority.Condition3;
     ruleset1.Condition4 = highPriority.Condition4;
     ruleset1.Condition5 = highPriority.Condition5;
     ruleset1.Condition6 = highPriority.Condition6;
     ruleset1.Editor = highPriority.Editor;
     ruleset1.ID = highPriority.Id;
     ruleset1.Priority = highPriority.Priority;
     ruleset1.Udt = highPriority.Udt;
     ProcessRuleSet ruleset2 = new ProcessRuleSet();
     ruleset2.Cdt = lowPriority.Cdt;
     ruleset2.Condition1 = lowPriority.Condition1;
     ruleset2.Condition2 = lowPriority.Condition2;
     ruleset2.Condition3 = lowPriority.Condition3;
     ruleset2.Condition4 = lowPriority.Condition4;
     ruleset2.Condition5 = lowPriority.Condition5;
     ruleset2.Condition6 = lowPriority.Condition6;
     ruleset2.Editor = lowPriority.Editor;
     ruleset2.ID = lowPriority.Id;
     ruleset2.Priority = lowPriority.Priority;
     ruleset2.Udt = lowPriority.Udt;
     //若有应用Rule Set List表格中的当前选项或其上一个选项的Rule存在,则删除Model_Process数据表中的所有记录。
     if ((processRepository.GetAllRuleByRuleSetID(highPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(highPriority.Id).Count > 0)
         || (processRepository.GetAllRuleByRuleSetID(lowPriority.Id) != null && processRepository.GetAllRuleByRuleSetID(lowPriority.Id).Count > 0))
     {
         processRepository.DeleteAllModelProcessDefered(uow);
     }
     ProcessRuleSet tempRuleSet1 = processRepository.GetRuleSetById(ruleset1.ID);
     ProcessRuleSet tempRuleSet2 = processRepository.GetRuleSetById(ruleset2.ID);
     ruleset1.Priority = tempRuleSet2.Priority;
     ruleset2.Priority = tempRuleSet1.Priority;
     processRepository.UpdateRuleSetPriorityDefered(uow, ruleset1);
     processRepository.UpdateRuleSetPriorityDefered(uow, ruleset2);
     uow.Commit();
 }
コード例 #10
0
        public void UpdateMaterialByCtList(IList<string> ctList,string stage,string editor,string station,string action,string line)
        {
            try
            {
                IMaterialRepository MaterialRepository = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository, Material>();
                IUnitOfWork uow = new UnitOfWork();
                foreach (string ct in ctList)  // For Mantis0000539
                {
                  Material m=MaterialRepository.Find(ct);
                  MaterialLog mLog = new MaterialLog();
                  mLog.Status="Collect";
                  mLog.Line="";
                  mLog.Stage=stage;
                  mLog.Editor=editor;
                  mLog.PreStatus = m.Status;
                  mLog.Action = "Combine Lot";
                  m.AddMaterialLog(mLog);
                  MaterialRepository.Update(m, uow);
                }

                //MaterialRepository.AddMultiMaterialCurStatusLogDefered
                //    (uow, ctList, action, stage, line, station, "", editor);
                 
                 MaterialRepository.UpdateMultiMaterialCurStatusDefered(uow, ctList, station, editor);
                 uow.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(CollectionMaterialLot)UpdateMaterialByCtList ");
            }
        
        }
コード例 #11
0
ファイル: SAInputXRay.cs プロジェクト: wra222/testgit
        public void Save(string input, string pdline, string model, string location, string obligation,string remark,string state, string customer, string editor)
        {
            logger.Debug("Save start, MBSno:" + input);
            try
            {
                var materialRep = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository>();
                IUnitOfWork uof = new UnitOfWork();
                Material material = new Material();

                material.MaterialCT = input;
                material.MaterialType = "XRay";
                material.Model = model;
                material.Line = pdline;
                material.DeliveryNo = state;
                material.PalletNo = location;
                material.CartonSN = obligation;
                material.PreStatus = "XRay";
                material.Status = "1";
                material.ShipMode = remark;
                material.Editor = editor;
                material.Cdt = DateTime.Now;
                material.Udt = DateTime.Now;
                
                materialRep.Add(material, uof);
                uof.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug(" InputMB end, MBSno:" + input);
            }

        }
コード例 #12
0
        //add/save partforbidden
        public int SavePartForbidden(PartForbiddenMaintainInfo infoPartForbidden)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                PartForbidden partForbiddenObj = null;
                if (infoPartForbidden.Id != 0)
                {
                    partForbiddenObj = partRepository.GetPartForbidden(infoPartForbidden.Id);
                }
                if (partForbiddenObj == null)
                {
                    //检查是否已存在相同的PartForbidden
                    int count = partRepository.CheckExistedPartForbidden(infoPartForbidden.Model, infoPartForbidden.Descr, infoPartForbidden.PartNo, infoPartForbidden.AssemblyCode, infoPartForbidden.Family);
                    if (count > 0)
                    {
                        ex = new FisException("DMT039", paraError);
                        throw ex;
                    }

                    partForbiddenObj = new PartForbidden();
                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();
                    partRepository.AddPartForbiddenDefered(work, partForbiddenObj);
                    work.Commit();

                }
                else
                {

                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();

                    partRepository.SavePartForbiddenDefered(work, partForbiddenObj);

                    work.Commit();
                }

                return partForbiddenObj.ID;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
コード例 #13
0
 public void DeletePartForbidden(int partForbiddenId)
 {
     try
     {
         PartForbidden objPartForbidden = partRepository.GetPartForbidden(partForbiddenId);
         IUnitOfWork work = new UnitOfWork();
         partRepository.DeletePartForbiddenDefered(work, objPartForbidden);
         work.Commit();
     }
     catch (FisException e)
     {
         logger.Error(e.mErrmsg);
         throw e;
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         throw;
     }
 }
コード例 #14
0
ファイル: AcquireIMEI.cs プロジェクト: wra222/testgit
        private IList<string> getIMEISeq(string model, string preFixCode, string custom, int qty)
        {
            string numType = "IMEI";
            try
            {
                IList<string> ret = new List<string>();
                if (qty == 1)
                {
                    ret.Add(getIMEISeq(model, preFixCode, custom));
                    return ret;
                }

                SqlTransactionManager.Begin();
                lock (_syncRoot_GetSeq)
                {
                    INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();

                    MACRange currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
                    if (currentRange == null)
                    {
                        throw new FisException("ICT014", new string[] { });
                    }
                    else
                    {
                        if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                        {
                            throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                        }
                        NumControl currentMaxNum = numCtrlRepository.GetMaxValue(numType, preFixCode);
                        if (currentMaxNum == null)
                        {
                            currentMaxNum = new NumControl();
                            currentMaxNum.NOName = preFixCode;
                            currentMaxNum.NOType = numType;
                            currentMaxNum.Value = currentRange.BegNo;
                            currentMaxNum.Customer = custom;
                            ret.Add(currentMaxNum.Value);
                            qty--;

                            IUnitOfWork uof = new UnitOfWork();
                            if (qty >0 && currentMaxNum.Value == currentRange.EndNo) //check Last Range
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                                currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
                                if (currentRange == null)
                                {
                                    throw new FisException("ICT014", new string[] { });
                                }
                            }                         

                            int remainingCount = qty;
                           
                            for (int j = 0; j < qty; j++)
                            {
                                remainingCount--;
                                int curNum = int.Parse(currentMaxNum.Value) + 1;
                                currentMaxNum.Value = curNum.ToString("D12");
                                if (remainingCount >0  && currentMaxNum.Value == currentRange.EndNo) //check Last Range
                                {
                                    numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                                    currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
                                    if (currentRange == null)
                                    {
                                        throw new FisException("ICT014", new string[] { });
                                    }

                                    if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                                    {
                                        throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                                    }

                                    if (currentMaxNum.Value == currentRange.BegNo || currentMaxNum.Value == currentRange.EndNo)
                                    {
                                        throw new FisException("ICT018", new string[] { currentMaxNum.Value });
                                    }
                                }
                                ret.Add(currentMaxNum.Value);
                            }

                            if (int.Parse(currentMaxNum.Value) > int.Parse(currentRange.EndNo))
                            {
                                throw new FisException("GEN022", new string[] { currentMaxNum.Value + ">" + currentRange.EndNo });
                            }

                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                            }
                            else
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Active);
                            }
                            numCtrlRepository.InsertNumControlDefered(uof, currentMaxNum);
                            uof.Commit();
                            SqlTransactionManager.Commit();
                            return ret;

                        }
                        else
                        {
                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatus(currentRange.ID, MACRange.MACRangeStatus.Closed);
                                currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R","A" });
                                if (currentRange == null)
                                {
                                    throw new FisException("ICT014", new string[] { });
                                }

                                if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                                {
                                    throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                                }

                                if (currentMaxNum.Value == currentRange.BegNo || currentMaxNum.Value == currentRange.EndNo)
                                {
                                    throw new FisException("ICT018", new string[] { currentMaxNum.Value });
                                }
                            }

                            IUnitOfWork uof = new UnitOfWork();

                            int remainingCount = qty;
                            for (int j = 0; j < qty; j++)
                            {
                                remainingCount--;
                                int curNextNum = int.Parse(currentMaxNum.Value) + 1;
                                currentMaxNum.Value = curNextNum.ToString("D12");
                                ret.Add(currentMaxNum.Value);
                                if (remainingCount > 0 && currentMaxNum.Value == currentRange.EndNo) //check Last Range
                                {
                                    numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                                    currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
                                    if (currentRange == null)
                                    {
                                        throw new FisException("ICT014", new string[] { });
                                    }

                                    if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                                    {
                                        throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                                    }

                                    if (currentMaxNum.Value == currentRange.BegNo || currentMaxNum.Value == currentRange.EndNo)
                                    {
                                        throw new FisException("ICT018", new string[] { currentMaxNum.Value });
                                    }
                                }                               
                            }

                            if (int.Parse(currentMaxNum.Value) > int.Parse(currentRange.EndNo))
                            {
                                throw new FisException("GEN022", new string[] { currentMaxNum.Value + ">" + currentRange.EndNo });
                            }

                          
                            numCtrlRepository.Update(currentMaxNum, uof);
                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                            }
                            else
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Active);
                            }
                            uof.Commit();
                            SqlTransactionManager.Commit();
                            return ret;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SqlTransactionManager.Rollback();
                throw e;
            }
            finally
            {
                SqlTransactionManager.Dispose();
                SqlTransactionManager.End();
            }


        }
コード例 #15
0
ファイル: AcquireIMEI.cs プロジェクト: wra222/testgit
        private string getIMEISeq(string model,string preFixCode,string custom)
        {
            string numType ="IMEI";
            try
            {
                SqlTransactionManager.Begin();
                lock (_syncRoot_GetSeq)
                {
                    INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();

                    MACRange currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R", "A" });
                    if (currentRange == null)
                    {
                        throw new FisException("ICT014", new string[] {});
                    }
                    else
                    {
                        if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                        {
                            throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                        }
                        NumControl currentMaxNum = numCtrlRepository.GetMaxValue(numType, preFixCode);
                        if (currentMaxNum == null)
                        {
                            currentMaxNum = new NumControl();
                            currentMaxNum.NOName = preFixCode;
                            currentMaxNum.NOType = numType;
                            currentMaxNum.Value = currentRange.BegNo;
                            currentMaxNum.Customer = custom;

                            IUnitOfWork uof = new UnitOfWork();
                            numCtrlRepository.InsertNumControlDefered(uof, currentMaxNum);
                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                            }
                            else
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Active);
                            }
                            uof.Commit();
                            SqlTransactionManager.Commit();
                            return currentMaxNum.Value;

                        }
                        else
                        {
                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatus(currentRange.ID, MACRange.MACRangeStatus.Closed);
                                currentRange = numCtrlRepository.GetMACRange(preFixCode, new string[] { "R" });
                                if (!validateIMEISettingRange(currentRange.BegNo, currentRange.EndNo))
                                {
                                    throw new FisException("CHK1086", new string[] { currentRange.BegNo + "~" + currentRange.EndNo });
                                }

                                if (currentMaxNum.Value == currentRange.BegNo || currentMaxNum.Value == currentRange.EndNo)
                                {
                                    throw new FisException("ICT018", new string[] { currentMaxNum.Value });
                                }
                            }

                            int curNextNum = int.Parse(currentMaxNum.Value)+1;
                            currentMaxNum.Value = curNextNum.ToString("D12");                          

                            IUnitOfWork uof = new UnitOfWork();
                            numCtrlRepository.Update(currentMaxNum, uof);
                            if (currentMaxNum.Value == currentRange.EndNo)
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Closed);
                            }
                            else
                            {
                                numCtrlRepository.SetMACRangeStatusDefered(uof, currentRange.ID, MACRange.MACRangeStatus.Active);
                            }
                            uof.Commit();
                            SqlTransactionManager.Commit();
                            return currentMaxNum.Value;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SqlTransactionManager.Rollback();
                throw e;
            }
            finally
            {
                SqlTransactionManager.Dispose();
                SqlTransactionManager.End();
            }


        }
コード例 #16
0
ファイル: PCAOQCInput.cs プロジェクト: wra222/testgit
        public string saveMB(string Inputstring, string editor, string station, string customer)
        {
            logger.Debug("(PCAOQCInputImpl)saveMB start Input:" + Inputstring + "editor:" + editor + "station:" + station + "customer:" + customer);

            //FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retLst = new ArrayList();
            IMBRepository iMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            ArrayList lstRet = new ArrayList();
            UnitOfWork uow = new UnitOfWork();
            string returnstring = "OK";
            try
            {
                IMB mb = iMBRepository.Find(Inputstring);
                if (mb != null)
                {
                    string preStation = mb.MBStatus.Station;
                    string status = (string)mb.MBStatus.Status.ToString();
                    string line = mb.MBStatus.Line;
                    if (preStation != "15")
                    {
                        string[] param = { Inputstring, status, preStation };
                        throw new FisException("SFC009", param);
                    }
                    mb.MBStatus.Station = "31A";
                    mb.MBStatus.Status = MBStatusEnum.Pass;
                    mb.MBStatus.Editor = editor;
                    mb.MBStatus.Udt = DateTime.Now;
                    //记录MB Log
                    MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31A", (int)MBStatusEnum.Pass, line, editor, new DateTime());
                    mb.AddLog(mb_log);
                    iMBRepository.Update(mb, uow);
                }
                uow.Commit();
                return returnstring;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(PCAOQCInputImpl)saveMB End Input:" + Inputstring + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        }
コード例 #17
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 保存一条family的记录数据(Add)
        /// </summary>
        /// <param name="Object"></param>
        public void AddFamily(FamilyDef obj)
        {
            FamilyDef familyObj = obj;

            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                UnitOfWork uow = new UnitOfWork();
                Family item = new Family(obj.Family,obj.Descr,obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;
                itemRepository.Add(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }


        }
コード例 #18
0
ファイル: ECRVersionManager.cs プロジェクト: wra222/testgit
        public void SaveECRVersion(EcrVersionInfo info)
        {
            logger.Debug("(ECRVersionManager)SaveECRVersion start, [info]:" + info);
            IEcrVersionRepository ier = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>();
            IUnitOfWork work = new UnitOfWork();
            IList<EcrVersion> lstEcrVersion = null;

            try
            {
                lstEcrVersion = ier.GetECRVersionByFamilyMBCodeAndECR(info.Family, info.MBCode, info.ECR);

                if (lstEcrVersion == null || lstEcrVersion.Count == 0)
                {
                    ier.Add(GetEcrVersion(info), work);
                }
                else
                {
                    if (lstEcrVersion[0].ID == info.ID)
                    {
                        ConvertEcrVersionForUpdate(lstEcrVersion[0], info);
                //        ier.Update(lstEcrVersion[0], work);
                        ier.UpdateEcrVersionMaintainDefered(work, lstEcrVersion[0],info.Family,info.MBCode,info.ECR);
                    }
                    else
                    {
                        List<string> param = new List<string>();

                        throw new FisException("DMT137", param);
                    }
                }

                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            finally
            {
                logger.Debug("(ECRVersionManager)SaveECRVersion end, [info]:" + info);
            }            
        }
コード例 #19
0
        /// <summary>
        /// 產生CustomerSN號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        { 
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //lock (_syncRoot_GetSeq)//用于防止同一段代码被同时执行,以前只有一个Service时有效,现在多个Service没有去掉,聊胜于无

            //var logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //logger.InfoFormat("GenerateCustomerSnActivity: CurrentSession Hash: {0}; CurrentSession Key: {1}; CurrentSession Type: {2}", CurrentSession.GetHashCode().ToString(), CurrentSession.Key, CurrentSession.Type.ToString());
            //logger.InfoFormat("GenerateCustomerSnActivity: IProduct Hash: {0}; IProduct Key: {1}", product.GetHashCode().ToString(), product.Key);

            //need modify
            try
            {
                //CN(中try国代码)+U(Site Code)+年尾码+周别码+流水码
                string custSn = "";
                DateTime curDate = DateTime.Now;
               // string year = curDate.Year.ToString();
                string maxnum = "";
                string prestr = "";
                //求当前日期是一年的中第几周
                //int weeks = 0;
                DateTime dateTime = DateTime.Now;//new DateTime(2016,1,1);
                var ret = IMES.Infrastructure.Utility.Generates.WeekRuleEngine.Calculate("103", dateTime);
                string weekCode = ret.Week.ToString().PadLeft(2, '0');
                string year = ret.Year.ToString();//dateTime.Year.ToString();

                custSn = "CN" + "U" + custSn + year.Substring(year.Length - 1, 1) + weekCode;//weeks.ToString("d2");
                prestr = custSn;
                // 自己管理事务开始
                SqlTransactionManager.Begin();
                IUnitOfWork uof = new UnitOfWork();//使用自己的UnitOfWork


                //从NumControl中获取流水号
                //GetMaxNumber
                INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                bool addflag = false;
                maxnum = numControl.GetMaxNumber("CPQSNO", prestr + "{0}");
                if (string.IsNullOrEmpty(maxnum))
                {
                    maxnum = "Z000";    //起始值:Z000
                    addflag = true;
                }
                else
                {
                    //maxnum="CNU248000Y";
                    string temstr = "Z000"; //起始值:Z000
                    string numstr = maxnum.Substring(maxnum.Length - 4);
                    temstr = numstr;

                    if (numstr.ToUpper() == "YZZZ")
                    {
                        FisException fe = new FisException("CHK867", new string[] { });   //流水号已满!
                        throw fe;
                    }

                    string[] seqLst = new string[4];
                    seqLst[0] = temstr.Substring(0, 1);
                    seqLst[1] = temstr.Substring(1, 1);
                    seqLst[2] = temstr.Substring(2, 1);
                    seqLst[3] = temstr.Substring(3, 1);
                    
                    int[] idexLst = getSeqNum(seqLst);

                    if (idexLst[3] == 30)
                    {
                        if (idexLst[2] == 30)
                        {
                            if (idexLst[1] == 30)
                            {
                                if (idexLst[0] == 29)
                                {
                                    List<string> errpara = new List<string>();
                                    throw new FisException("CHK867", errpara);  //流水号已满!
                                }
                                else
                                {
                                    if (idexLst[0] == 30)
                                    {
                                        idexLst[0] = 28;
                                    }
                                    else if (idexLst[0] == 28)
                                    {
                                        idexLst[0] = 27;
                                    }
                                    else if (idexLst[0] == 27)
                                    {
                                        idexLst[0] = 29;
                                    }
                                    else
                                    {
                                        List<string> errpara = new List<string>();
                                        throw new FisException("CHK867", errpara);  //非合法的Z、X、W、Y,视为满
                                    }

                                    idexLst[1] = 0;
                                    idexLst[2] = 0;
                                    idexLst[3] = 0;
                                }
                            }
                            else
                            {
                                idexLst[1] += 1;
                                idexLst[2] = 0;
                                idexLst[3] = 0;
                            }
                        }
                        else
                        {
                            idexLst[2] += 1;
                            idexLst[3] = 0;
                        }
                    }
                    else
                    {
                        idexLst[3] += 1;
                    }

                    temstr = numLst[idexLst[0]] + numLst[idexLst[1]] + numLst[idexLst[2]] + numLst[idexLst[3]];
                    maxnum = temstr;
                }

                custSn = custSn + maxnum.ToUpper();

                product.CUSTSN = custSn;
                productRep.Update(product, uof);

                NumControl item = new NumControl();
                item.NOType = "CPQSNO";
                item.Value = custSn;
                item.NOName = "";
                item.Customer = "HP";

                numControl.SaveMaxNumber(item, addflag, prestr + "{0}");
                 
                uof.Commit();  //立即提交UnitOfWork更新NumControl里面的最大值

                SqlTransactionManager.Commit();//提交事物,释放行级更新锁
                
                // [Customer SN Print]保存结果:增加更新[CustomerSN_Qty]. CustomerSN_Qty栏位
                //UPDATE [HPIMES].[dbo].[MO]
                //SET [CustomerSN_Qty] =[ CustomerSN_Qty]+1
                //From Product a,MO b  WHERE a.MO=b.MO and a.ProductID=ProductID#

                IMORepository moRepository = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>();
                moRepository.UpdateMoForIncreaseCustomerSnQty(product.ProId, 1);

            }
            catch (Exception)
            {
                SqlTransactionManager.Rollback();
                throw;
            }
            finally
            {
                SqlTransactionManager.Dispose();
                SqlTransactionManager.End();
            }

            CurrentSession.AddValue(Session.SessionKeys.PrintLogName, product.Customer + "SNO");
            CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, product.ProId);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, product.ProId);
            CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, product.CUSTSN);
            
            return base.DoExecute(executionContext);
        }
コード例 #20
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 保存一条MACRang的记录数据(update)
        /// </summary>
        /// <param name="Object"></param>
        /// <returns></returns>
        public void UpdateMACRange(MACRangeDef obj, String oldMACRangeId)
        {
            try
            {
                INumControlRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository>();

                UnitOfWork uow = new UnitOfWork();
                MACRange item = itemRepository.GetMACRange(Int32.Parse(obj.id));
                //if (item.Status != "R" && (item.BegNo != obj.BegNo || item.EndNo != obj.EndNo))
                //{
                //    List<string> erpara = new List<string>();
                //    FisException ex;
                //    ex = new FisException("MDT001", erpara);
                //    throw ex;
                //}

                item.Code= obj.Code;
                item.BegNo=obj.BegNo;
                item.EndNo=obj.EndNo;
                //item.Status=obj.Status;
                item.Editor=obj.Editor;
                item.Udt= DateTime.Now;

                itemRepository.UpdateMACRange(item);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #21
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 删除一条Warranty数据
        /// </summary>
        /// <param name="?"></param>
        public void DeleteWarranty(String id)
        {
            try
            {
                IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
                UnitOfWork uow = new UnitOfWork();
                Warranty item = itemRepository.Find(Int32.Parse(id));
                               
                itemRepository.Remove(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }

        }
コード例 #22
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        ///  保存一条Warranty的记录数据 (update)
        /// </summary>
        /// <param name="Object"></param>
        public void UpdateWarranty(WarrantyDef obj, String oldWarrantyId)
        {

            IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
            if (itemRepository.GetExistWarranty(obj.Customer, obj.Descr, Int32.Parse(obj.id)).Rows.Count > 0)
            {
                //throw new ApplicationException("Already exist warranty with the same description under the customer in database.");
                List<string> erpara = new List<string>();
                FisException ex;
                ex = new FisException("DMT001", erpara);
                throw ex;
            }

            try
            {              
                UnitOfWork uow = new UnitOfWork();
                Warranty item = itemRepository.Find(Int32.Parse(obj.id));
                item.Customer = obj.Customer;
                item.Type = obj.Type;
                item.DateCodeType = obj.DateCodeType;
                item.WarrantyFormat = obj.WarrantyFormat;
                item.ShipTypeCode = obj.ShipTypeCode;
                item.WarrantyCode = obj.WarrantyCode;
                item.Descr = obj.Descr;
                item.Editor = obj.Editor;
                item.Udt = DateTime.Now;
                itemRepository.Update(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }

        }
コード例 #23
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 保存一条Warranty的记录数据(Add)
        /// </summary>
        /// <param name="?"></param>
        public string AddWarranty(WarrantyDef obj)
        {

            IWarrantyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository>();
            if (itemRepository.GetExistWarranty(obj.Customer, obj.Descr).Rows.Count > 0)
            {
                //throw new ApplicationException("Already exist warranty with the same description under the customer in database.");
                List<string> erpara = new List<string>();
                FisException ex;
                ex = new FisException("DMT001", erpara);
                throw ex;
            }

            int id = 0;
            try
            {
                UnitOfWork uow = new UnitOfWork();
                Warranty item = new Warranty
                    (id, 
                    obj.Customer,
                    obj.Type,
                    obj.DateCodeType,
                    obj.WarrantyFormat,
                    obj.ShipTypeCode,
                    obj.WarrantyCode,
                    obj.Descr,
                    obj.Editor,
                    DateTime.Now,
                    DateTime.Now
                    );
  
                itemRepository.Add(item, uow);
                uow.Commit();
                id=item.Id;
            }
            catch (Exception)
            {
                throw;
            }
            return id.ToString();

        }
コード例 #24
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
 /// <summary>
 /// "删除一条family的记录数据
 /// </summary>
 /// <param name="?"></param>
 public void DeleteFamily(FamilyDef obj)
 {
     try
     {
         IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
         UnitOfWork uow = new UnitOfWork();
         Family item = itemRepository.Find(obj.Family);
         itemRepository.Remove(item, uow);
         uow.Commit();
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #25
0
ファイル: FAIModelMaintain.cs プロジェクト: wra222/testgit
        private void InsertFAIModel(string model, string editor)
        {
            string OnlyNeedOQCApprove = CommonImpl.GetInstance().GetValueFromSysSetting("OnlyNeedOQCApprove");
            string FAIFAQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIFAQty");
            string FAIPAKQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIPAKQty");

            string modelType = GetModelType(model);
            string FAState = "";
            // 新增ApprovalStatus
            if ("Y" == OnlyNeedOQCApprove)
            {
                string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue, 
Status, Editor, Cdt, Udt)
select 
a.ID, @AddModel as ModuleKeyValue, 
case when IsNeedApprove='Y' 
	  then 'Waiting'
	  else 'Option'
      end as [Status], @CurrentUser, 
GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a 
where 
a.Module= @ModelType and 
a.Department = 'OQC'";

                SqlParameter[] paramsArray = new SqlParameter[3];
                paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
                paramsArray[0].Value = editor;
                paramsArray[1] = new SqlParameter("@AddModel", SqlDbType.VarChar);
                paramsArray[1].Value = model;
                paramsArray[2] = new SqlParameter("@ModelType", SqlDbType.VarChar);
                paramsArray[2].Value = "FAI" + modelType;

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
                                                                                    System.Data.CommandType.Text,
                                                                                    strSQL,
                                                                                    paramsArray);

                FAState = "Approval";
            }
            else if (string.IsNullOrEmpty(OnlyNeedOQCApprove) || "N" == OnlyNeedOQCApprove)
            {
                string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue, 
Status, Editor, Cdt, Udt)
select a.ID, @AddModel as ModuleKeyValue, 
		case when IsNeedApprove='Y' 
		then 'Waiting'
		else 'Option'
		end as [Status], @CurrentUser, GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a 
where 
a.Module= @ModelType
";

                SqlParameter[] paramsArray = new SqlParameter[3];
                paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
                paramsArray[0].Value = editor;
                paramsArray[1] = new SqlParameter("@AddModel", SqlDbType.VarChar);
                paramsArray[1].Value = model;
                paramsArray[2] = new SqlParameter("@ModelType", SqlDbType.VarChar);
                paramsArray[2].Value = "FAI" + modelType;

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
                                                                                    System.Data.CommandType.Text,
                                                                                    strSQL,
                                                                                    paramsArray);

                FAState = "Waiting";
            }

            DateTime now = DateTime.Now;

            FAIModelInfo itemFai = new FAIModelInfo()
            {
                Model = model,
                ModelType = modelType,
                PlanInputDate = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0),
                FAQty = int.Parse(FAIFAQty),
                inFAQty = 0,
                PAKQty = int.Parse(FAIPAKQty),
                inPAKQty = 0,
                PAKStartDate = now,
                FAState = FAState,
                PAKState = "Hold",
                Remark = "KeyIn",
                Editor = editor,
                Cdt = now,
                Udt = now
            };

            IUnitOfWork uow = new UnitOfWork();

            iModelRepository.InsertFAIModelDefered(uow, itemFai);

            uow.Commit();
        }
コード例 #26
0
ファイル: PCAOQCInput.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 扫描9999,结束工作流
        /// 如果没有Defect,即defectCodeList为null或cout为0
        /// 将Session.AddValue(Session.SessionKeys.HasDefect,false)
        /// 否则Session.AddValue(Session.SessionKeys.HasDefect,true)
        /// </summary>
        /// <param name="mbsno">mbsno</param>
        /// <param name="defectCodeList">defectCodeList</param>
        public string save(string LotNo, String strCMD, string editor, string line, string customer)
        {
            logger.Debug("(PCAOQCInputImpl)save start,"
                + " LotNo: " + LotNo
                + " KeyCode:" + strCMD);
            FisException ex;
            List<string> erpara = new List<string>();
            IMBRepository iMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            string returnstring = "OK";
            try
            {
                if (strCMD == "LOCK") //Update Lot.Status=3
                {
                    LotInfo setLotInfo = new LotInfo();
                    LotInfo conLotInfo = new LotInfo();
                    conLotInfo.lotNo = LotNo;
                    setLotInfo.status = "3";
                    setLotInfo.editor = editor;
                    setLotInfo.udt = DateTime.Now;
                    iMBRepository.UpdateLotInfo(setLotInfo, conLotInfo);
                }
                else if (strCMD == "UNLOCK") //Update Lot.Status=2
                {
                    LotInfo setLotInfo = new LotInfo();
                    LotInfo conLotInfo = new LotInfo();
                    conLotInfo.lotNo = LotNo;
                    setLotInfo.status = "2";
                    setLotInfo.editor = editor;
                    setLotInfo.udt = DateTime.Now;
                    iMBRepository.UpdateLotInfo(setLotInfo, conLotInfo);
                }
                else if (strCMD == "UNDO")
                {
                    UnitOfWork uow = new UnitOfWork();
                    //	Update Lot.Status=4
                    LotInfo setLotInfo = new LotInfo();
                    LotInfo conLotInfo = new LotInfo();
                    conLotInfo.lotNo = LotNo;
                    setLotInfo.status = "4";
                    setLotInfo.editor = editor;
                    setLotInfo.udt = DateTime.Now;
                    iMBRepository.UpdateLotInfoDefered(uow,setLotInfo, conLotInfo);
                    //Update PCBStatus where PCBNo in PCBLot.PCBNo and PCBLot.Status=1 and LotNo=#LotNo Station=10 Status=1
                    PcblotInfo conupPcblot = new PcblotInfo();
                    conupPcblot.lotNo= LotNo;
                    conupPcblot.status = "1";
                    IList<PcblotInfo> upPcblotLst = new List<PcblotInfo>();
                    upPcblotLst = iMBRepository.GetPcblotInfoList(conupPcblot);
                    if ((upPcblotLst == null) || (upPcblotLst.Count == 0))
                    {

                    }
                    else
                    {
                        for (int i = 0; i < upPcblotLst.Count; i++)
                        {
                            IMB mb = iMBRepository.Find(upPcblotLst[i].pcbno);
                            if (mb != null)
                            {
                                mb.MBStatus.Station = "10";
                                mb.MBStatus.Status = MBStatusEnum.Pass;
                                mb.MBStatus.Editor = editor;
                                mb.MBStatus.Udt = DateTime.Now;
                                //记录MB Log 	Insert PCBLog  Station=’31A’ Status=’0’ PdLine=‘UNDO
                                MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31A", (int)MBStatusEnum.Fail, "UNDO", editor, new DateTime());
                                mb.AddLog(mb_log);
                                iMBRepository.Update(mb, uow);
                            }
                        }
                    }
                    //	Update PCBLot.Status=0
                    PcblotInfo conPcblot = new PcblotInfo();
                    PcblotInfo setPcblot = new PcblotInfo();
                    conPcblot.lotNo = LotNo;
                    setPcblot.status = "0";
                    iMBRepository.UpdatePCBLotInfoDefered(uow, setPcblot, conPcblot);
                    uow.Commit();
                }
                else if (strCMD == "PASS")
                {
                    //	若当前Lot.Status=’3’,则报错:“该Lot已锁定,请解锁后再做放行”
                    LotInfo conLotInfo = new LotInfo();
                    conLotInfo.lotNo = LotNo;
                    IList<LotInfo> getLotInfo = iMBRepository.GetlotInfoList(conLotInfo);
                    if (getLotInfo[0].status == "3")
                    {
                        erpara.Add(LotNo);
                        ex = new FisException("CHK319", erpara); //该Lot已锁定,请解锁后再做放行!
                        throw ex;
                    }
                    //	获取LotSetting.FailQty(先用PdLine检索,若不存在,再用’ALL’检索,若不存在,则报错:“请IE维护LotSetting”)
                    LotSettingInfo conlotSetting = new LotSettingInfo();
                    int failQtyforLine = 0;
                    conlotSetting.line = getLotInfo[0].line;
                    conlotSetting.type = getLotInfo[0].type;
                    IList<LotSettingInfo> LotSettinglst = iMBRepository.GetLotSettingInfoList(conlotSetting);
                    if ((LotSettinglst == null) || (LotSettinglst.Count == 0))
                    {
                        conlotSetting = new LotSettingInfo();
                        conlotSetting.line = "ALL";
                        conlotSetting.type = getLotInfo[0].type;
                        LotSettinglst = iMBRepository.GetLotSettingInfoList(conlotSetting);
                        if ((LotSettinglst == null) || (LotSettinglst.Count == 0))
                        {
                            //报错:“请与IE联系,维护 Lot 相关设置”
                            List<string> errpara = new List<string>();
                            errpara.Add(LotNo);
                            ex = new FisException("CHK278", errpara);
                            throw ex;
                        }
                        else
                        {
                            failQtyforLine = LotSettinglst[0].failQty;
                        }
                    }
                    else
                    {
                        failQtyforLine = LotSettinglst[0].failQty;
                    }
                    //	获取当前Lot的PCBLot.Status=0的数量@CNT,
                    //若@CNT大于或者等于LotSetting.FailQty,则Update Lot.Status=3,并提示:“该Lot抽检失败的数量过多,已被锁定”;
                    PcblotInfo conpassPcblot = new PcblotInfo();
                    conpassPcblot.lotNo = LotNo;
                    conpassPcblot.status = "0";
                    IList<PcblotInfo> passPcblotLst = new List<PcblotInfo>();
                    int pcbfailCount = 0;
                    passPcblotLst = iMBRepository.GetPcblotInfoList(conpassPcblot);
                    if ((passPcblotLst == null) || (passPcblotLst.Count == 0))
                    {
                        pcbfailCount = 0;
                    }
                    else
                    {
                        pcbfailCount = passPcblotLst.Count;
                    }
                    //int pcbfailCount = passPcblotLst.Count;
                    if (pcbfailCount >= failQtyforLine)
                    {
                        LotInfo setfailLotInfo = new LotInfo();
                        LotInfo confailLotInfo = new LotInfo();
                        confailLotInfo.lotNo = LotNo;
                        setfailLotInfo.status = "3";
                        setfailLotInfo.editor = editor;
                        setfailLotInfo.udt = DateTime.Now;
                        iMBRepository.UpdateLotInfo(setfailLotInfo, confailLotInfo);
                        List<string> errpara = new List<string>();
                        errpara.Add(LotNo);
                        ex = new FisException("CHK318", errpara);//该Lot抽检失败的数量过多,已被锁定
                        throw ex;
                    }
                    else
                    {
                        //Update Lot.Status=9;
                        UnitOfWork uof = new UnitOfWork(); 
                        LotInfo setfailLotInfo = new LotInfo();
                        LotInfo confailLotInfo = new LotInfo();
                        confailLotInfo.lotNo = LotNo;
                        setfailLotInfo.status = "9";
                        setfailLotInfo.editor = editor;
                        setfailLotInfo.udt = DateTime.Now;
                        iMBRepository.UpdateLotInfoDefered(uof,setfailLotInfo, confailLotInfo);
                        // Update PCBStatus where PCBNo in PCBLot.PCBNo and PCBLot.Status=1 (Station=31 and Status=1);
                        // Insert PCBLog (Station=31 and Status=1)
                        //UpdatePCBStatus(PCBStatusInfo setValue, PCBStatusInfo condition)
                        PcblotInfo conupPcblot = new PcblotInfo();
                        conupPcblot.lotNo = LotNo;
                        conupPcblot.status = "1";
                        IList<PcblotInfo> upPcblotLst = new List<PcblotInfo>();
                        upPcblotLst = iMBRepository.GetPcblotInfoList(conupPcblot);
                        if ((upPcblotLst == null) || (upPcblotLst.Count == 0))
                        {

                        }
                        else
                        {
                             for (int i = 0; i < upPcblotLst.Count; i++)
                            {
                                IMB mb = iMBRepository.Find(upPcblotLst[i].pcbno);
                                if (mb != null)
                                {
                                    //UC Update  
                                    //Update PCBStatus where PCBNo in PCBLot.PCBNo and PCBLot.Status=1 and  
                                    //Station=31A and Status=1【2012-6-20】 (Station=31 and Status=1);
                                    if ((mb.MBStatus.Station == "31A") && (mb.MBStatus.Status == MBStatusEnum.Pass))
                                    {
                                        mb.MBStatus.Station = "31";
                                        mb.MBStatus.Status = MBStatusEnum.Pass;
                                        mb.MBStatus.Editor = editor;
                                        mb.MBStatus.Udt = DateTime.Now;
                                        //记录MB Log 	Insert PCBLog (Station=31 and Status=1)
                                        MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31", (int)MBStatusEnum.Pass, line, editor, new DateTime());
                                        mb.AddLog(mb_log);
                                        iMBRepository.Update(mb, uof);
                                    }
                                }
                            }
                        }
                        uof.Commit();
                    }

                }
                return returnstring;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(PCAOQCInputImpl)save end,"
                   + " LotNo: " + LotNo
                   + " KeyCode:" + strCMD);
            }
        }
コード例 #27
0
ファイル: FAIModelMaintain.cs プロジェクト: wra222/testgit
        private void UpdateFAIModel(string model, string editor)
        {
            IUnitOfWork uow = new UnitOfWork();
            IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            IList<IProduct> lstPrds = prodRep.GetProductListByModel(model);
            if (null != lstPrds && lstPrds.Count > 0)
            {
                lstPrds = lstPrds.Where(x => x.ProductInfoes.Any(y => (y.InfoType == "FAIinFA" || y.InfoType == "FAIinPAK") && y.InfoValue == "Y")).ToList();
                foreach (IProduct p in lstPrds)
                {
                    prodRep.BackUpProductInfoDefered(uow, p.ProId, editor, "FAIinFA");
                    prodRep.BackUpProductInfoDefered(uow, p.ProId, editor, "FAIinPAK");

                    IMES.FisObject.FA.Product.ProductInfo item = new IMES.FisObject.FA.Product.ProductInfo();
                    item.ProductID = p.ProId;
                    item.InfoType = "FAIinFA";
                    item.InfoValue = "";
                    item.Editor = editor;

                    IMES.FisObject.FA.Product.ProductInfo cond = new IMES.FisObject.FA.Product.ProductInfo();
                    cond.ProductID = p.ProId;
                    cond.InfoType = "FAIinFA";
                    prodRep.UpdateProductInfoDefered(uow, item, cond);

                    //

                    item = new IMES.FisObject.FA.Product.ProductInfo();
                    item.ProductID = p.ProId;
                    item.InfoType = "FAIinPAK";
                    item.InfoValue = "";
                    item.Editor = editor;

                    cond = new IMES.FisObject.FA.Product.ProductInfo();
                    cond.ProductID = p.ProId;
                    cond.InfoType = "FAIinPAK";
                    prodRep.UpdateProductInfoDefered(uow, item, cond);

                }
            }

            string OnlyNeedOQCApprove = CommonImpl.GetInstance().GetValueFromSysSetting("OnlyNeedOQCApprove");
            string FAIFAQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIFAQty");
            string FAIPAKQty = CommonImpl.GetInstance().GetValueFromSysSetting("FAIPAKQty");

            // 刪除
            ApprovalStatusInfo condApprovalStatus = new ApprovalStatusInfo();
            condApprovalStatus.ModuleKeyValue = model;
            IList<ApprovalStatusInfo> lstApprovalStatus = iModelRepository.GetApprovalStatus(condApprovalStatus);
            if (null != lstApprovalStatus && lstApprovalStatus.Count > 0)
            {
                foreach (ApprovalStatusInfo approvalStatusInfo in lstApprovalStatus)
                {
                    UploadFilesInfo condUploadFiles = new UploadFilesInfo();
                    condUploadFiles.ApprovalStatusID = approvalStatusInfo.ID;
                    IList<UploadFilesInfo> lstUploadFilesInfo = iModelRepository.GetUploadFiles(condUploadFiles);
                    if (null != lstUploadFilesInfo && lstUploadFilesInfo.Count > 0)
                    {
                        foreach (UploadFilesInfo uploadFilesInfo in lstUploadFilesInfo)
                            iModelRepository.DeleteUploadFiles(uploadFilesInfo.ID);
                    }

                    iModelRepository.DeleteApprovalStatus(approvalStatusInfo.ID);
                }
            }

            string FAState = "";
            // 新增ApprovalStatus
            if ("Y" == OnlyNeedOQCApprove)
            {
                string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue, 
Status, Editor, Cdt, Udt)
select 
a.ID, b.Model as ModuleKeyValue, 
case when IsNeedApprove='Y' 
	  then 'Waiting'
	  else 'Option'
      end as [Status], @CurrentUser, 
GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a , FAIModel b
where b.Model=@OpenModel and 
a.Module= 'FAI'+b.ModelType and 
a.Department = 'OQC'";

                SqlParameter[] paramsArray = new SqlParameter[2];
                paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
                paramsArray[0].Value = editor;
                paramsArray[1] = new SqlParameter("@OpenModel", SqlDbType.VarChar);
                paramsArray[1].Value = model;

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
                                                                                    System.Data.CommandType.Text,
                                                                                    strSQL,
                                                                                    paramsArray);

                FAState = "Approval";
            }
            else if (string.IsNullOrEmpty(OnlyNeedOQCApprove) || "N" == OnlyNeedOQCApprove)
            {
                string strSQL = @"insert into ApprovalStatus(
ApprovalItemID, ModuleKeyValue, 
Status, Editor, Cdt, Udt)
select a.ID, b.Model as ModuleKeyValue, 
		case when IsNeedApprove='Y' 
		then 'Waiting'
		else 'Option'
		end as [Status], @CurrentUser, GETDATE() as Cdt, GETDATE() as Udt
from ApprovalItem a , FAIModel b
where b.Model=@OpenModel and 
       a.Module= 'FAI'+b.ModelType
";

                SqlParameter[] paramsArray = new SqlParameter[2];
                paramsArray[0] = new SqlParameter("@CurrentUser", SqlDbType.VarChar);
                paramsArray[0].Value = editor;
                paramsArray[1] = new SqlParameter("@OpenModel", SqlDbType.VarChar);
                paramsArray[1].Value = model;

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString_FA,
                                                                                    System.Data.CommandType.Text,
                                                                                    strSQL,
                                                                                    paramsArray);

                FAState = "Waiting";
            }

            DateTime now = DateTime.Now;

            FAIModelInfo itemFai = iModelRepository.GetFAIModelByModel(model);
            itemFai.Model = model;
            itemFai.PlanInputDate = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0);
            itemFai.FAQty = int.Parse(FAIFAQty);
            itemFai.inFAQty = 0;
            itemFai.PAKQty = int.Parse(FAIPAKQty);
            itemFai.inPAKQty = 0;
            itemFai.FAState = FAState;
            itemFai.PAKState = "Hold";
            itemFai.Remark = "Reopen";
            itemFai.Editor = editor;
            itemFai.Cdt = now;
            itemFai.Udt = now;
            
            iModelRepository.UpdateFAIModelDefered(uow, itemFai);

            uow.Commit();
        }
コード例 #28
0
ファイル: PCAOQCInput.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 刷mbsno,调用该方法启动工作流,根据输入mbsno获取Lot
        /// 返回MNSB LIST 
        /// </summary>
        /// <param name="mbsno">mbsno</param>
        /// <param name="editor">editor</param>
        /// <param name="station">station</param>
        /// <param name="customer">customer</param>
        /// <param name="curMBInfo">curMBInfo</param>
        /// <returns>model</returns>
        public ArrayList inputMBSnoORLotNo(string InputStr, string InputType, string editor, string station, string customer)
        {
            logger.Debug("(PCAOQCInputImpl)Input MBSN or LotNo start:" + InputStr + "editor:" + editor + "station:" + station + "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retLst = new ArrayList();
            IMBRepository iMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            string LotNO = "";
            ArrayList lstRet = new ArrayList();
           try
            {
                //若刷入数据为MBSN,获取MBSN的所在LotNo(PCBLot.LotNo where PCBNo=@MBSN and Status=1),
                // 则不存在记录,则报错:“该MBSN未组Lot”
                if (InputType == "MBSN")
                {
                    PcblotInfo conPcblot = new PcblotInfo();
                    conPcblot.pcbno = InputStr;
                    conPcblot.status = "1";
                    IList<PcblotInfo> pcblotLstA = new List<PcblotInfo>();
                    pcblotLstA = iMBRepository.GetPcblotInfoList(conPcblot);
                    if ((pcblotLstA == null) || (pcblotLstA.Count == 0))
                    {
                        erpara.Add(InputStr);
                        ex = new FisException("CHK312", erpara); //该MBSN未组Lot
                        throw ex;
                    }
                    if (pcblotLstA.Count==1)
                    {
                        LotNO = pcblotLstA[0].lotNo;
                    }
                    else
                    {
                        var pcblotLst =
                            from item in pcblotLstA
                            orderby item.cdt descending
                            select item;
                        foreach (PcblotInfo tmpNode in pcblotLst)
                        {
                            LotNO = tmpNode.lotNo;
                            break;
                        }
                    }
                  
                }
                else
                {
                    LotNO = InputStr;
                }
                
                string sessionKey = LotNO;

                //2、	获取LotNo的详细信息(Lot.* where Lot.LotNo=@LotNo);若Lot信息不存在,则报错:“该Lot不存在”
                LotInfo conLotInfo = new LotInfo();
                conLotInfo.lotNo = LotNO;
                IList<LotInfo> getLotInfo = iMBRepository.GetlotInfoList(conLotInfo);
                if ((getLotInfo == null) || (getLotInfo.Count == 0))
                {
                    erpara.Add(LotNO);
                    ex = new FisException("CHK313", erpara); //该Lot不存在
                    throw ex;
                }
                //若Lot.Status=’0’,则报错:“Lot没有组合完成”;
                if (getLotInfo[0].status == "0")
                {
                    erpara.Add(LotNO);
                    ex = new FisException("CHK314", erpara); //Lot没有组合完成
                    throw ex;
                }
                //若Lot.Status=’4’,则报错:“该Lot已解散”;
                if (getLotInfo[0].status == "4")
                {
                    erpara.Add(LotNO);
                    ex = new FisException("CHK315", erpara); //该Lot已解散
                    throw ex;
                }
                //若Lot.Status=’9’,则报错:“该Lot已经通过OQC”
                if (getLotInfo[0].status == "9")
                {
                    erpara.Add(LotNO);
                    ex = new FisException("CHK316", erpara); //该Lot已经通过OQC
                    throw ex;
                }
                //4、	Update Lot Status
                //若Lot.Status=1,则Update Lot.Status=2;
                //Update PCBStatus(where PCBNo in PCBLot.PCBNo and Status=1 and LotNo=@LotNo);
                UnitOfWork uow = new UnitOfWork(); 
                if (getLotInfo[0].status.Trim() == "1")
                {
                    LotInfo setLotInfo = new LotInfo();
                    conLotInfo = new LotInfo();
                    conLotInfo.lotNo = getLotInfo[0].lotNo;
                    //conLotInfo.type = strType;
                    //setLotInfo.qty = retlot[0].qty + 1;//1;//setValue.Qty赋1,其他按需要赋值即可
                    setLotInfo.status = "2";
                    setLotInfo.editor = editor;
                    setLotInfo.udt = DateTime.Now;
                    //itemRepository.UpdateLotInfoDefered(CurrentSession.UnitOfWork, setLotInfo, conLotInfo);
                    iMBRepository.UpdateLotInfoDefered(uow, setLotInfo, conLotInfo);
                //}
                    //DEBUG Mantis 1009(itc-1414-0224)
                    //update PCBStatus,PCBLog  ->条件也要: Lot.Status=1
                    
                   //Update PCBStatus:Station=’31A’Status=’1’
                    //Insert PCBLog
                    //Insert PCBLog:Station=’31A’Status=’1’
                    PcblotInfo conPcblot4 = new PcblotInfo();
                    //conPcblot = new PcblotInfo();
                    conPcblot4.lotNo= LotNO;
                    conPcblot4.status = "1";
                    IList<PcblotInfo>pcblotLst4 = new List<PcblotInfo>();
                    pcblotLst4 = iMBRepository.GetPcblotInfoList(conPcblot4);
                    if ((pcblotLst4 == null) || (pcblotLst4.Count == 0))
                    {

                    }
                    else
                    {
                        for (int i = 0; i < pcblotLst4.Count; i++)
                        {
                            IMB mb = iMBRepository.Find(pcblotLst4[i].pcbno);
                            if (mb != null)
                            {
                                mb.MBStatus.Station = "31A";
                                mb.MBStatus.Status = MBStatusEnum.Pass;
                                mb.MBStatus.Editor = editor;
                                mb.MBStatus.Udt = DateTime.Now;
                                //记录MB Log
                                MBLog mb_log = new MBLog(0, mb.Sn, mb.Model, "31A", (int) MBStatusEnum.Pass,
                                                         getLotInfo[0].line, editor, new DateTime());
                                mb.AddLog(mb_log);
                                iMBRepository.Update(mb, uow);
                            }
                        }
                    }
                }
                uow.Commit();

                //5、重新获取Lot信息,并显示LotNo Line[Line.Descr] Type PCS = Qty Status[2:OQC In;3:Locked]
                conLotInfo = new LotInfo();
                conLotInfo.lotNo = LotNO;
                IList<LotInfo> ReturnLotInfo = iMBRepository.GetlotInfoList(conLotInfo);
                ILineRepository lineRepository = RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>();
                Line lineInfo = lineRepository.Find(ReturnLotInfo[0].line);
                if (lineInfo == null)
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK317", erpara); //该PCB %1 没有PdLine,请确认!
                    throw ex;
                }
                string lotLineinfo = ReturnLotInfo[0].line.Trim() + "[" +lineInfo.Descr.Trim() + "]";
                string strStatus="";
                if (ReturnLotInfo[0].status == "2")
                {
                    strStatus = "OQC In";
                }
                else if (ReturnLotInfo[0].status == "3")
                {
                    strStatus = "Locked";
                }
                //Old--获取PCBLot信息,并显示PCBLot.PCBNo where LotNo=@LotNo and Status=1
                //PcblotInfo RtnconPcblot = new PcblotInfo();
                //RtnconPcblot.lotNo = ReturnLotInfo[0].lotNo;
                //RtnconPcblot.status = "1";
                //IList<PcblotInfo> rtnpcblotLst = new List<PcblotInfo>();
                //rtnpcblotLst = iMBRepository.GetPcblotInfoList(RtnconPcblot);
                //IList<string> mbsnList = new List<string>();
                //foreach (PcblotInfo pcblotnode in rtnpcblotLst)
                //{
                //    mbsnList.Add(pcblotnode.pcbno.Trim());
                //}
               //UC Update 
               //	获取LotSetting.CheckQty(先用PdLine检索,若不存在,再用’ALL’检索,若不存在,则报错:“请IE维护LotSetting”),
               //若[Checked Qty]>=LotSetting.CheckQty,---则执行[4 Save Data] PASS分支:界面初始时不自动处理
                var checkQtyforLine = 0;
                LotSettingInfo conlotSetting = new LotSettingInfo();
                conlotSetting.line = ReturnLotInfo[0].line;
                //add type 
                conlotSetting.type = ReturnLotInfo[0].type;
                IList<LotSettingInfo> LotSettinglst = iMBRepository.GetLotSettingInfoList(conlotSetting);
                if ((LotSettinglst == null) || (LotSettinglst.Count == 0))
                {
                    conlotSetting = new LotSettingInfo();
                    conlotSetting.line = "ALL";
                    conlotSetting.type = ReturnLotInfo[0].type;
                    LotSettinglst = iMBRepository.GetLotSettingInfoList(conlotSetting);
                    if ((LotSettinglst == null) || (LotSettinglst.Count == 0))
                    {
                        //报错:“请与IE联系,维护 Lot 相关设置”
                        List<string> errpara = new List<string>();
                        //errpara.Add(currenMB.Sn);
                        FisException ex1 = new FisException("CHK278", errpara);
                        throw ex1;
                    }
                    else
                    {
                        checkQtyforLine = LotSettinglst[0].checkQty;
                    }
                }
                else
                {
                    checkQtyforLine = LotSettinglst[0].checkQty;
                }
               
               //======================================================================================
                //UC Update 2012/07/03 
                //6、	获取PCBLot信息,并显示在[MBSN List]和[Checked Qty]( [Checked Qty]: Sum(Checked))
                //参考方法:
                //select a.PCBNo, ISNULL(b.Status,'0') as Checked from PCBLot a
                //      left Join PCBLotCheck b
                //      on a..PCBNo where LotNo = b.=@LotNo
                //      and a.PCBNo = b.PCBNo
                //   where a.LotNo=@LotNo and a.Status=1
                //   order by a.PCBNo
                IList<string> mbsnList = new List<string>();
                IList<string> checkedList = new List<string>();
                DataTable PcbLotCheckedTable = iMBRepository.GetPcbNoAndCheckStatusList(ReturnLotInfo[0].lotNo, "1");
                if (PcbLotCheckedTable == null)
                {
                    //throw new FisException("CHM001", new string[] { model1 });
                }
                else
                {
                    var pcbLotCheckedCount = PcbLotCheckedTable.Rows.Count;
                    for (int i = 0; i < pcbLotCheckedCount; i++)
                    {
                        mbsnList.Add(PcbLotCheckedTable.Rows[i][0] as string);
                        checkedList.Add(PcbLotCheckedTable.Rows[i][1] as string);
                    }
                }
                var pcblotcheck = new PcblotcheckInfo();
                pcblotcheck.lotNo = LotNO;
                pcblotcheck.status = "1";
                var iCheckqty = iMBRepository.GetCountOfPcblotCheck(pcblotcheck);
                var havePromptstr = "";
                if (ReturnLotInfo[0].status !="2")
                {
                    try
                    {
                        throw new FisException("CHK401", new List<string>());

                    }
                    catch (FisException ex1)
                    {
                        havePromptstr = ex1.mErrmsg;
                    }
                }
             
                lstRet.Add(ReturnLotInfo[0].lotNo);      //0
                lstRet.Add(lotLineinfo);                 //1 
                lstRet.Add(ReturnLotInfo[0].type);       //2
                lstRet.Add(ReturnLotInfo[0].qty);        //3 
                lstRet.Add(strStatus);                   //4
                lstRet.Add(mbsnList);                    //5
                lstRet.Add(ReturnLotInfo[0].line);       //6
                lstRet.Add(checkedList);                 //7
                lstRet.Add(checkQtyforLine);             //8
                lstRet.Add(iCheckqty);                   //9
                lstRet.Add(havePromptstr);              //10
                return lstRet;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PCAOQCInputImpl)Input MBSN or LotNo end  Input:" + InputStr + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        }
コード例 #29
0
ファイル: ECRVersionManager.cs プロジェクト: wra222/testgit
        public void DeleteECRVersion(EcrVersionInfo info)
        {
            logger.Debug("(ECRVersionManager)DeleteECRVersion start, [info]:" + info);
            IEcrVersionRepository ier = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>();
            EcrVersion ecrVersion = null;
            IUnitOfWork work = new UnitOfWork();

            try
            {
                ecrVersion = ier.Find(info.ID);
        //        IList<EcrVersion> tempList = ier.GetECRVersionByFamilyMBCodeAndECR(info.Family, info.MBCode, info.ECR);
       //         ecrVersion = tempList[0];

                if (ecrVersion != null)
                {
                    ier.Remove(ecrVersion, work);

                    work.Commit();
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
            finally
            {
                logger.Debug("(ECRVersionManager)DeleteECRVersion end, [info]:" + info);
            } 
        }
コード例 #30
0
        public ArrayList Save(string firstProID, string deliveryNo, IList<PrintItem> printItems)
        {
            logger.Debug("(CombinePoInCarton)Save start, firstProID:" + firstProID);

            try
            {
                IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                Session currentSession = SessionManager.GetInstance.GetSession(firstProID, SessionType);

                if (currentSession == null)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(firstProID);
                    ex = new FisException("CHK021", erpara);
                    logger.Error(ex.Message, ex);
                    throw ex;
                }
                else
                {
                    Delivery curDn = deliveryRep.Find(deliveryNo);
                    currentSession.AddValue(Session.SessionKeys.Delivery, curDn);

                    //如果Product 非Frame Or TRO Or BaseModel Or SLICE 的话,需要报告错误:“Product is not Frame Or TRO Or BaseModel Or SLICE” 
                    //SELECT @PN = Value FROM ModelInfo NOLOCk WHERE Model = @Model AND Name = 'PN'
                    IProduct product = (IProduct)currentSession.GetValue(Session.SessionKeys.Product);
                    product.DeliveryNo = deliveryNo;

                    IList<IProduct> proList = (List<IProduct>)currentSession.GetValue(Session.SessionKeys.ProdList);
                    foreach (IProduct item in proList)
                    {
                        item.DeliveryNo = deliveryNo;
                    }

                    string pn = "";
                    string modelstr = product.Model;
                    Model curModel = modelRep.Find(product.Model);
                    pn = curModel.GetAttribute("PN");

                    bool labelFlag = false;
                    if (!string.IsNullOrEmpty(pn) && pn.Length >= 6)
                    {
                        if (pn.Substring(5, 1) == "U"
                            || pn.Substring(5, 1) == "E"
                            || product.Model.Substring(0, 3) == "156"
                            || product.Model.Substring(0, 3) == "173"
                            || product.Model.Substring(0, 3) == "146"
                            || product.Model.Substring(0, 3) == "157"
                            || product.Model.Substring(0, 3) == "158"
                            || product.Model.Substring(0, 2) == "PO"
                            || product.Model.Substring(0, 2) == "2P"
                            || product.Model.Substring(0, 3) == "172"
                            || product.Model.Substring(0, 2) == "BC")
                        {
                            labelFlag = true;
                        }
                    }
                    if (!labelFlag)
                    {
                        SessionManager.GetInstance.RemoveSession(currentSession);
                        FisException fe = new FisException("PAK133", new string[] { });  //Product is not Frame Or TRO Or BaseModel Or SLICE
                        throw fe;
                    }

                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, true);
                    currentSession.Exception = null;
                    currentSession.SwitchToWorkFlow();
                }

                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                ArrayList retList = new ArrayList();
                IList<PrintItem> printList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);
                Delivery delivery = (Delivery)currentSession.GetValue(Session.SessionKeys.Delivery);
                Product curProd = (Product)currentSession.GetValue(Session.SessionKeys.Product);

                int totalQty = delivery.Qty;
                int packedQty = 0;

                var tmpList = productRep.GetProductListByDeliveryNo(delivery.DeliveryNo);
                foreach (var prod in tmpList)
                {
                    if (!string.IsNullOrEmpty(prod.CartonSN))
                    {
                        packedQty++;
                    }
                }

                string locate = (string)currentSession.GetValue("Location");                
                //a)	如果Remain Qty = 0,则提示用户:’Po:’ + @Delivery + ‘ is finished!’;
                //提示用户后,执行Reset(Reset 说明见下文)
                //b)	如果PCs in Carton > Remain Qty,则令[PCs in Carton] = Remain Qty
                string strEnd="";
                int remainQty = totalQty - packedQty;
                if (remainQty == 0)
                {
                    //5.当页面选择的Delivery 已经完成Combine PO in Carton_RCTO 时,需要将Delivery.Status 更新为'82'
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(delivery.DeliveryNo);
                    ex = new FisException("PAK136", erpara);//’Po:’ + @Delivery + ‘ is finished!’
                    strEnd = ex.mErrmsg;

                    IUnitOfWork uof = new UnitOfWork();
                    delivery.Status = "87";
                    delivery.Udt = DateTime.Now;
                    delivery.Editor = currentSession.Editor;
                    deliveryRep.Update(delivery,uof);
                    uof.Commit(); 
                }


                //当Delivery 的CQty 属性=1,但Delivery.Model 的NoCarton 属性(Model.InfoType = ‘NoCarton’)不存在,或者存在但<>’Y’ 时,也需要列印Carton Label
                //Model curModel = modelRep.Find(curProduct.Model);
                Model model = modelRep.Find(curProd.Model);
                string noCarton = model.GetAttribute("NoCarton");

                string cQtyStr = (string)delivery.GetExtendedProperty("CQty");
                int cQty = 0;
                if (string.IsNullOrEmpty(cQtyStr))
                {
                    cQty = 5;
                }
                else
                {
                    decimal tmp = Convert.ToDecimal(cQtyStr);
                    cQty = Convert.ToInt32(tmp);
                }

                string printflag = "N";
                if (cQty > 1 || (cQty == 1 && noCarton != "Y"))
                {
                    printflag = "Y";
                }
                printflag = "Y";
                retList.Add(printList);
                retList.Add(packedQty);
                retList.Add(curProd.CartonSN);
                retList.Add(curProd.DeliveryNo);
                retList.Add(curProd.CUSTSN);
                retList.Add(strEnd);
                retList.Add(printflag);

                return retList;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(CombinePoInCarton)Print end, firstProID:" + firstProID);
            }
        }