Exemple #1
0
        private void 查询组批_Click(object sender, EventArgs e)
        {
            mixs.LoadDataByWhere("main.WLLX='熔剂' and main.SampleState=@SampleState", SampleState.初始状态);
            ches.LoadDataByWhere("main.WLLX='熔剂' and main.SampleState=@SampleState", SampleState.初始状态);
            if (ches.Count > 0)
            {
                for (int j = 0; j < ches.Count; j++)
                {
                    if (ches[j].Sample_Mix_ID == 0)
                    {
                        bool cunzai = false;
                        if (mixs.Count > 0)
                        {
                            for (int m = 0; m < mixs.Count; m++)
                            {
                                if (ches[j].SupplierCode == mixs[m].SupplierCode && ches[j].MatCode == mixs[m].MatCode && mixs[m].MixPlanCount > mixs[m].MixCount)
                                {
                                    cunzai = true;
                                    ches[j].Sample_Mix_ID = mixs[m].Sample_Mix_ID;
                                    ches[j].Save();
                                    mixs[m].MixCount++;
                                    mixs[m].Save();
                                }
                            }
                        }
                        if (cunzai == false)
                        {
                            QC_Material   matInfo = QC_Material.GetByID(ches[j].MatPK);
                            QC_Sample_Mix mix     = new QC_Sample_Mix();

                            mix.WpCode        = "0087";
                            mix.FangTong_Time = DateTime.Now;
                            mix.FangTong_User = LocalInfo.Current.user.ID;
                            mix.MatCode       = ches[j].MatCode;
                            mix.MatPK         = ches[j].MatPK;
                            mix.MixCount      = 1;
                            mix.MixPlanCount  = matInfo.BatchNum;
                            mix.SupplierCode  = ches[j].SupplierCode;
                            mix.MixUser       = LocalInfo.Current.user.ID;
                            mix.SampleState   = SampleState.初始状态;
                            mix.SampleType    = SampleType.普通样;
                            mix.WLLX          = ches[j].WLLX;
                            mix.CardID        = Zhc.Data.DbContext.GetSeq("RJ" + DateTime.Now.Date.ToString("yyyyMMdd"), 2);
                            mix.Save();
                            mixs.Add(mix);

                            ches[j].Sample_Mix_ID = mix.Sample_Mix_ID;
                            ches[j].Save();
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            mixs.LoadDataByWhere("main.WLLX='外矿' and main.SampleState=@SampleState", SampleState.初始状态);
            vehs.LoadDataByWhere("main.WLLX='外矿' and main.SampleState=@SampleState", SampleState.初始状态);

            for (int j = 0; j < vehs.Count; j++)
            {
                if (vehs[j].Sample_Mix_ID == 0)
                {
                    bool cunzai = false;
                    for (int m = 0; m < mixs.Count; m++)
                    {
                        if (vehs[j].SupplierCode == mixs[m].SupplierCode && vehs[j].MatCode == mixs[m].MatCode && mixs[m].MixPlanCount > mixs[m].MixCount)
                        {
                            cunzai = true;
                            vehs[j].Sample_Mix_ID = mixs[m].Sample_Mix_ID;
                            vehs[j].Save();
                            mixs[m].MixCount++;
                            mixs[m].Save();
                        }
                    }
                    if (cunzai == false)
                    {
                        QC_Material   matInfo = QC_Material.GetByID(vehs[j].MatPK);
                        QC_Sample_Mix mix     = new QC_Sample_Mix();

                        mix.WpCode = "0090";

                        mix.MatCode      = vehs[j].MatCode;
                        mix.MatPK        = vehs[j].MatPK;
                        mix.MixCount     = 1;
                        mix.MixPlanCount = matInfo.BatchNum;
                        mix.SupplierCode = vehs[j].SupplierCode;
                        mix.MixUser      = LocalInfo.Current.user.ID;
                        mix.SampleState  = SampleState.初始状态;
                        mix.SampleType   = SampleType.普通样;
                        mix.WLLX         = vehs[j].WLLX;
                        mix.CardID       = "WK" + Zhc.Data.DbContext.GetSeq(DateTime.Now.Date.ToString("yyyyMMdd"), 2);
                        mix.Save();
                        mixs.Add(mix);

                        vehs[j].Sample_Mix_ID = mix.Sample_Mix_ID;
                        vehs[j].Save();
                    }
                }
            }
        }