// <summary> /// Get MO (For Query) /// </summary> /// <param name="mo">mo</param> /// <param name="model">Model</param> /// <param name="family">family</param> /// <param name="editor">editor</param> /// <param name="stationId">stationId</param> /// <param name="customerId">customerId</param> /// <returns>MOInfoList查询结果</returns> public IList<MOInfo> GetVirtualForQuery(string mo, string model, string family, string editor, string stationId, string customerId) { //UC Revision:6789: //SELECT MO, Model, CreateDate, StartDate, Qty, Print_Qty FROM MO // WHERE MO = @MO //或者 //SELECT MO, Model, CreateDate, StartDate, Qty, Print_Qty FROM MO // WHERE Model = @Model and Qty> Print_Qty order by MO //或者 //SELECT MO, Model, CreateDate, StartDate, Qty, Print_Qty FROM MO a,Model b // WHERE a.Model=b.Model and b.Family= @Family and Qty> Print_Qty order by MO //查询顺序具有优先级: MO -> Model -> Family //Revision: 8815: 查询窗口的查询结果增加CustomerSN_Qty的显示 try { var currentMORepository = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>(); IList<MOInfo> returnMOList = new List<MOInfo>(); if (!string.IsNullOrEmpty(mo)) { MO moItem = new IMES.FisObject.Common.MO.MO(); moItem = currentMORepository.Find(mo); if (moItem != null) { MOInfo tempMO = new MOInfo(); tempMO.createDate = moItem.CreateDate; tempMO.startDate = moItem.StartDate; tempMO.qty = moItem.Qty; tempMO.pqty = moItem.PrtQty; tempMO.model = moItem.Model; tempMO.id = moItem.MONO; tempMO.customerSN_Qty = moItem.CustomerSN_Qty; returnMOList.Add(tempMO); } } else if (!string.IsNullOrEmpty(model)) { IList<MOInfo> MOInfoList = new List<MOInfo>(); MOInfoList = currentMORepository.GetMOList(model); if (MOInfoList != null) { foreach (MOInfo moItem in MOInfoList) { if (moItem.qty > moItem.pqty) { returnMOList.Add(moItem); } } } } else if (!string.IsNullOrEmpty(family)) { returnMOList = currentMORepository.GetMOListByFamily(family); } return returnMOList; } catch (FisException e) { throw e; } catch (Exception e) { throw new SystemException(e.Message); } }
/// <summary> /// Save Virtual MO /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var moList = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.VirtualMOList); string virtualMO = moList[0]; string model = (string)CurrentSession.GetValue(Session.SessionKeys.ModelName); short Qty; short.TryParse(CurrentSession.GetValue(Session.SessionKeys.Qty).ToString(),out Qty); string st = (string)CurrentSession.GetValue(Session.SessionKeys.StartDate); DateTime startDate = DateTime.Parse(st); string plant = "CP81"; IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<SysSettingInfo> plantList = ipartRepository.GetSysSettingInfoes(new SysSettingInfo() { name = "PlantCode" }); if (plantList != null && plantList.Count > 0) { plant = plantList[0].value; } //INSERT INTO [IMES_GetData].[dbo].[MO]([MO],[Plant],[Model],[CreateDate],[StartDate],[Qty],[SAPStatus],[SAPQty], //[Print_Qty],[Status ],[Cdt],[Udt]) //VALUES(@VirtualMO, 'CP81', @Model, GETDATE(), GETDATE(), @Qty, '', 0, 0, 'H', GETDATE(), GETDATE()) //UC Revision: 6789: 保存StartDate //INSERT INTO [IMES_GetData].[dbo].[MO]([MO],[Plant],[Model],[CreateDate],[StartDate],[Qty],[SAPStatus],[SAPQty], //[Print_Qty],[Status ],[Cdt],[Udt]) //VALUES(@VirtualMO, 'CP81', @Model, GETDATE(), @StartDate, @Qty, '', 0, 0, 'H', GETDATE(), GETDATE()) // UC Revision: 8613 : // INSERT INTO [IMES_GetData].[dbo].[MO]([MO],[Plant],[Model],[CreateDate],[StartDate],[Qty],[SAPStatus],[SAPQty], // [Print_Qty],[Transfer_Qty],[Status ],[Cdt],[Udt]) // VALUES(@VirtualMO, 'CP81', @Model, GETDATE(), @StartDate, @Qty, '', 0 @Qty, 0, 0, 'H', GETDATE(), GETDATE()) // Revision: 8815: // INSERT INTO [IMES_GetData].[dbo].[MO]([MO],[Plant],[Model],[CreateDate],[StartDate],[Qty],[SAPStatus],[SAPQty], // [Print_Qty],[Transfer_Qty], [CustomerSN_Qty], [Status ],[Cdt],[Udt]) // VALUES(@VirtualMO, 'CP81', @Model, GETDATE(), @StartDate, @Qty, '', 0 @Qty, 0, 0, 0, 'H', GETDATE(), GETDATE()) MO currentMO = new MO(); currentMO.MONO = virtualMO; //currentMO.Plant = "CP81"; currentMO.Plant = plant; currentMO.Model = model; currentMO.StartDate = startDate; currentMO.Qty = Qty; currentMO.SAPStatus = ""; currentMO.SAPQty = Qty; currentMO.PrtQty = (short)0; currentMO.TransferQty = (short)0; currentMO.CustomerSN_Qty = (short)0; currentMO.Status = "H"; IMORepository moRepository = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>(); moRepository.Add(currentMO,CurrentSession.UnitOfWork); return base.DoExecute(executionContext); }