Beispiel #1
0
        /// <summary>
        /// 没实际批次
        /// </summary>
        /// <param name="lotID"></param>
        /// <param name="sourceOrderID">源工单ID</param>
        /// <param name="sourceType"></param>
        /// <param name="dtSampleDate"></param>
        /// <param name="creator"></param>
        /// <param name="samplecount"></param>
        /// <param name="plancheckitemstring"></param>
        /// <param name="firscheck"></param>
        /// <param name="checkType"></param>
        /// <returns></returns>
        static public ReturnValue AutoCreateCheckOrder(int defpk, int hutid, string lotid, string sourceOrderID, SampleTypeEnum sampleType, DateTime dtSampleDate, string creator, int samplecount = 1, string plancheckitemstring = "", bool firscheck = true, CheckTypeEnum checkType = CheckTypeEnum.Normal)
        {
            if (!string.IsNullOrWhiteSpace(sourceOrderID))
            {
                EncodeCollection <CheckOrder> ec = Encode.EncodeData.GetDatas <CheckOrder>("sourceorderid = '" + sourceOrderID + "'", string.Empty, 1);
                if (ec.Count > 0)
                {
                    return(new ReturnValue(true, 1, "检验单已创建"));
                }
            }
            //find lot
            // EncodeCollection<MMReiptOrder> ecMR = Encode.EncodeData.GetDatas<MMReiptOrder>(string.Format("sitlotid='{0}'", lotID), string.Empty, -1);
            // MMLot lot = SSIT.Bread.UI.MM.MMCommon.GetLotbyID(lotID);
            //if (lot != null)
            //if(ecMR.Count > 0 )
            //{
            //MMReiptOrder mr = ecMR[0];
            //先创建SampleItem
            CheckOrder si = new CheckOrder {
                LotID = lotid, HutPK = hutid, DefPK = defpk
            };

            //si.HutID = lot.HutID;
            si.SampleID      = CheckOrder.GetNewCheckID(dtSampleDate);
            si.CheckQuantity = samplecount;
            si.PlanCheckDate = si.SampleDate = dtSampleDate.ToString(EncodeConst.DateFormat);
            //si.CreateType = createType;
            si.CheckOrderState     = CheckOrderStateEnum.Submit;
            si.SourceOrderID       = sourceOrderID;
            si.SampleType          = sampleType;
            si.Creator             = creator;
            si.CreateTime          = dtSampleDate.ToString(EncodeConst.DateTimeFormat);
            si.PlanCheckItemString = plancheckitemstring;
            //si.FirstCheck = firscheck;
            //if(User.CurrentUser != null)
            //{
            //    si.ActualInspector = User.CurrentUser.ParamName;
            //}
            if (string.IsNullOrWhiteSpace(si.PlanCheckItemString))
            {
                DefinitionCheckItemCombine combine = DefinitionCheckItemCombine.GetItemby(si.DefPK);
                if (combine != null)
                {
                    List <int> list = CheckItem.Instance.GetIdList(combine.GetCheckItems());
                    si.PlanCheckItemString = SSITEncode.Common.STRING.IntListToString(list);
                }
            }
            si.State = DataState.New;
            //EncodeCollection<SampleItemOrder> ec = new EncodeCollection<SampleItemOrder>(si);
            ReturnValue rv = Encode.EncodeData.SaveDatas <CheckOrder>(new EncodeCollection <CheckOrder>(si));

            if (rv.Success)
            {
                rv.ValueString = si.SampleID;
                //SSIT.SystemManager.DataInterface.MessageContent.CreateNewMessage(BreadInterface.SampleTypeEnum.QMOrder, si.SampleID, creator);
            }
            return(rv);

            // return new ReturnValue(false, -444, "找不到对应批次");
        }
Beispiel #2
0
        static public CheckOrder CreateCheckOrderbySample(SampleOrder sample)
        {
            var order = new CheckOrder
            {
                State           = DataState.New,
                CreateTime      = DateTime.Now.ToString(EncodeConst.DateTimeFormat),
                CheckOrderID    = GetNewCheckID(DateTime.Today),
                CheckOrderState = CheckOrderStateEnum.Submit,
                Creator         = User.CurrentUser?.ParamName,
                CheckQuantity   = 1,
                DefPK           = sample.DefPK,
                HutPK           = sample.HutPK,
                LotID           = sample.LotID,
                PlanCheckDate   = sample.SampleDate,
                SampleID        = sample.SampleID,
                SampleType      = sample.SampleType,
                SourceOrderID   = sample.SourceOrderID,
                SampleDate      = sample.SampleDate,
            };

            if (string.IsNullOrWhiteSpace(order.PlanCheckItemString))
            {
                DefinitionCheckItemCombine combine = DefinitionCheckItemCombine.GetItemby(order.DefPK);
                if (combine != null)
                {
                    List <int> list = CheckItem.Instance.GetIdList(combine.GetCheckItems());
                    order.PlanCheckItemString = SSITEncode.Common.STRING.IntListToString(list);
                }
            }
            return(order);
            //ReturnValue rv = Encode.EncodeData.SaveDatas<CheckOrder>(new EncodeCollection<CheckOrder>(order));
            //if (rv.Success)
            //{
            //    rv.ValueString = order.SampleID;
            //    //SSIT.SystemManager.DataInterface.MessageContent.CreateNewMessage(BreadInterface.SampleTypeEnum.QMOrder, si.SampleID, creator);
            //}
            //return rv;
        }
Beispiel #3
0
        public void LoadInfo()
        {
            rpvCheckCategory.Pages.Clear();
            Dictionary <string, EncodeCollection <CheckItem> > dic = new Dictionary <string, EncodeCollection <CheckItem> >();
            EncodeCollection <CheckItem> ecCheckItems = null;

            if (_sampleOrder.GetPlanCheckItemCount <= 0)
            {
                //Definition def = SSIT.Bread.UI.MM.MMCommon.GetDefinitionbyID(_sampleOrder.DefinitionID);
                //MMCheckItemCombine combine = MMCheckItemCombine.Instance.GetItembyKey(_sampleOrder.DefinitionID);
                DefinitionCheckItemCombine combine = DefinitionCheckItemCombine.GetItemby(_sampleOrder.DefPK);
                if (combine != null)
                {
                    ecCheckItems = combine.GetCheckItems();
                }
            }
            else
            {
                EncodeCollection <CheckItem> ec = new EncodeCollection <CheckItem>();
                foreach (short id in _sampleOrder.PlanCheckItems)
                {
                    CheckItem checkitem = CheckItem.Instance.Itemof(id);
                    if (checkitem != null)
                    {
                        ec.Add(checkitem);
                    }
                }
                ecCheckItems = ec;
            }
            if (ecCheckItems != null)
            {
                foreach (CheckItem item in ecCheckItems)
                {
                    string CheckCategoryName = item.GetCheckCategory();
                    if (!string.IsNullOrEmpty(CheckCategoryName))
                    {
                        if (!dic.ContainsKey(CheckCategoryName))
                        {
                            dic.Add(CheckCategoryName, new EncodeCollection <CheckItem>());
                        }
                        dic[CheckCategoryName].Add(item);
                    }
                }
            }
            EncodeCollection <CheckData> datas = CheckData.LoadDatasbySampleID(_sampleOrder.SampleID);
            int maxIndex = 0;

            if (datas.Count > 0)
            {
                foreach (var item in datas)
                {
                    maxIndex = Math.Max(item.SampleIndex, maxIndex);
                }
            }
            if (maxIndex >= _sampleOrder.CheckQuantity)
            {
                _sampleOrder.CheckQuantity = maxIndex;
            }
            SetOrderState();
            foreach (string key in dic.Keys)
            {
                Telerik.WinControls.UI.RadPageViewPage page = new Telerik.WinControls.UI.RadPageViewPage(key);
                InputGridBase grid = new InputGridBase {
                    Dock = DockStyle.Fill
                };
                page.Controls.Add(grid);
                if (_sampleOrder != null)
                {
                    grid.SampleCount = _sampleOrder.CheckQuantity;
                }
                page.Tag = grid;
                rpvCheckCategory.Pages.Add(page);
                grid.Order  = _sampleOrder;
                grid.Fields = CheckItemsToInputFields(dic[key]);
                grid.Init();
                grid.LoadDatas(datas);
                //grid.Columns.AutoSize(true);
            }

            if (datas.Count > 0)
            {
                DataStat();
            }
        }