コード例 #1
0
        public static bool Insert_2(SockliningMasterModel model)
        {
            DateTime dtDefault             = new DateTime(2000, 01, 01);
            var      @ProductNo            = new SqlParameter("@ProductNo", model.ProductNo);
            var      @Sequence             = new SqlParameter("@Sequence", model.Sequence);
            var      @SockliningLine       = new SqlParameter("@SockliningLine", model.SockliningLine);
            var      @SockliningStartDate  = new SqlParameter("@SockliningStartDate", model.SockliningStartDate);
            var      @SockliningFinishDate = new SqlParameter("@SockliningFinishDate", model.SockliningFinishDate);
            var      @SockliningQuota      = new SqlParameter("@SockliningQuota", model.SockliningQuota);

            DateTime sockliningActualStartDateDt     = TimeHelper.Convert(model.SockliningActualStartDate);
            DateTime sockliningActualFinishDateDt    = TimeHelper.Convert(model.SockliningActualFinishDate);
            string   sockliningActualStartDateString = "";

            if (sockliningActualStartDateDt != dtDefault)
            {
                sockliningActualStartDateString = String.Format("{0:MM/dd/yyyy}", sockliningActualStartDateDt);
            }
            string sockliningActualFinishDateString = "";

            if (sockliningActualFinishDateDt != dtDefault)
            {
                sockliningActualFinishDateString = String.Format("{0:MM/dd/yyyy}", sockliningActualFinishDateDt);
            }

            var @SockliningActualStartDate  = new SqlParameter("@SockliningActualStartDate", sockliningActualStartDateString);
            var @SockliningActualFinishDate = new SqlParameter("@SockliningActualFinishDate", sockliningActualFinishDateString);

            var @InsoleBalance = new SqlParameter("@InsoleBalance", model.InsoleBalance);
            var @InsockBalance = new SqlParameter("@InsockBalance", model.InsockBalance);

            var @IsSequenceUpdate                   = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate);
            var @IsSockliningLineUpdate             = new SqlParameter("@IsSockliningLineUpdate", model.IsSockliningLineUpdate);
            var @IsSockliningStartDateUpdate        = new SqlParameter("@IsSockliningStartDateUpdate", model.IsSockliningStartDateUpdate);
            var @IsSockliningFinishDateUpdate       = new SqlParameter("@IsSockliningFinishDateUpdate", model.IsSockliningFinishDateUpdate);
            var @IsSockliningQuotaUpdate            = new SqlParameter("@IsSockliningQuotaUpdate", model.IsSockliningQuotaUpdate);
            var @IsSockliningActualStartDateUpdate  = new SqlParameter("@IsSockliningActualStartDateUpdate", model.IsSockliningActualStartDateUpdate);
            var @IsSockliningActualFinishDateUpdate = new SqlParameter("@IsSockliningActualFinishDateUpdate", model.IsSockliningActualFinishDateUpdate);
            var @IsInsoleBalanceUpdate              = new SqlParameter("@IsInsoleBalanceUpdate", model.IsInsoleBalanceUpdate);
            var @IsInsockBalanceUpdate              = new SqlParameter("@IsInsockBalanceUpdate", model.IsInsockBalanceUpdate);

            using (var db = new SaovietMasterScheduleEntities())
            {
                if (db.ExecuteStoreCommand("EXEC spm_InsertSockliningMaster_3   @ProductNo, @Sequence, @SockliningLine, @SockliningStartDate, @SockliningFinishDate, @SockliningQuota, @SockliningActualStartDate, @SockliningActualFinishDate, @InsoleBalance, @InsockBalance, @IsSequenceUpdate, @IsSockliningLineUpdate, @IsSockliningStartDateUpdate, @IsSockliningFinishDateUpdate, @IsSockliningQuotaUpdate, @IsSockliningActualStartDateUpdate, @IsSockliningActualFinishDateUpdate, @IsInsoleBalanceUpdate, @IsInsockBalanceUpdate ",
                                           @ProductNo, @Sequence, @SockliningLine, @SockliningStartDate, @SockliningFinishDate, @SockliningQuota, @SockliningActualStartDate, @SockliningActualFinishDate, @InsoleBalance, @InsockBalance, @IsSequenceUpdate, @IsSockliningLineUpdate, @IsSockliningStartDateUpdate, @IsSockliningFinishDateUpdate, @IsSockliningQuotaUpdate, @IsSockliningActualStartDateUpdate, @IsSockliningActualFinishDateUpdate, @IsInsoleBalanceUpdate, @IsInsockBalanceUpdate) > 0)
                {
                    return(true);
                }
                return(false);
            }
        }
コード例 #2
0
        public static bool InsertSequence(SockliningMasterModel model)
        {
            var @ProductNo            = new SqlParameter("@ProductNo", model.ProductNo);
            var @Sequence             = new SqlParameter("@Sequence", model.Sequence);
            var @SockliningStartDate  = new SqlParameter("@SockliningStartDate", model.SockliningStartDate);
            var @SockliningFinishDate = new SqlParameter("@SockliningFinishDate", model.SockliningFinishDate);

            SaovietMasterScheduleEntities db = new SaovietMasterScheduleEntities();

            if (db.ExecuteStoreCommand("EXEC spm_InsertSockliningMasterSequence @ProductNo,@Sequence,@SockliningStartDate,@SockliningFinishDate", @ProductNo, @Sequence, @SockliningStartDate, @SockliningFinishDate) > 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #3
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            orderList                   = OrdersController.Select();
            rawMaterialList             = RawMaterialController.Select();
            sewingMasterList            = SewingMasterController.Select();
            outsoleMasterList           = OutsoleMasterController.Select();
            sockliningMasterList        = SockliningMasterController.Select();
            assemblyMasterList          = AssemblyMasterController.Select();
            productionMemoList          = ProductionMemoController.Select();
            outsoleRawMaterialList      = OutsoleRawMaterialController.Select();
            rawMaterialViewModelNewList = RawMaterialController.Select_1();
            //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing);
            assemblyMasterList = assemblyMasterList.OrderBy(s => s.Sequence).ToList();
            int[] materialIdUpperArray    = { 1, 2, 3, 4, 10 };
            int[] materialIdSewingArray   = { 5, 7 };
            int[] materialIdOutsoleArray  = { 6 };
            int[] materialIdAssemblyArray = { 8, 9 };
            int[] materialIdCartonArray   = { 11 };

            foreach (AssemblyMasterModel assemblyMaster in assemblyMasterList)
            {
                AssemblyMasterExportViewModel assemblyMasterExportView = new AssemblyMasterExportViewModel();
                assemblyMasterExportView.Sequence  = assemblyMaster.Sequence;
                assemblyMasterExportView.ProductNo = assemblyMaster.ProductNo;
                OrdersModel order  = orderList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault();
                string      memoId = "";
                if (order != null)
                {
                    assemblyMasterExportView.Country   = order.Country;
                    assemblyMasterExportView.ShoeName  = order.ShoeName;
                    assemblyMasterExportView.ArticleNo = order.ArticleNo;
                    assemblyMasterExportView.LastCode  = order.LastCode;
                    assemblyMasterExportView.Quantity  = order.Quantity;
                    assemblyMasterExportView.ETD       = order.ETD;

                    List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList();
                    for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++)
                    {
                        ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p];
                        memoId += productionMemo.MemoId;
                        if (p < productionMemoByProductionNumberList.Count - 1)
                        {
                            memoId += "\n";
                        }
                    }
                    assemblyMasterExportView.MemoId = memoId;
                }

                //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray);
                //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false;
                //if (materialArrivalOutsole != null)
                //{
                //    assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date);
                //    assemblyMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk;
                //}

                //// follow OutsoleRawMaterial
                //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList();
                //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList();
                //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false;

                //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false)
                //{
                //    assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max());
                //    assemblyMasterExportView.IsOutsoleMatsArrivalOk = true;
                //}
                //else
                //{
                //    var etdDateList = osRawMaterial.Select(s => s.ETD).ToList();
                //    if (etdDateList.Count() > 0)
                //    {
                //        assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max());
                //    }
                //}

                assemblyMasterExportView.IsOutsoleMatsArrivalOk = false;
                var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo);
                if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) &&
                    !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate))
                {
                    assemblyMasterExportView.OutsoleMatsArrival     = rawMaterialViewModelNew.OUTSOLE_ActualDate;
                    assemblyMasterExportView.IsOutsoleMatsArrivalOk = true;
                }
                else
                {
                    assemblyMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD;
                }

                MaterialArrivalViewModel materialArrivalAssembly = MaterialArrival(order.ProductNo, materialIdAssemblyArray);
                assemblyMasterExportView.IsAssemblyMatsArrivalOk = false;
                if (materialArrivalAssembly != null)
                {
                    assemblyMasterExportView.AssemblyMatsArrival     = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalAssembly.Date);
                    assemblyMasterExportView.IsAssemblyMatsArrivalOk = materialArrivalAssembly.IsMaterialArrivalOk;
                }

                MaterialArrivalViewModel materialArrivalCarton = MaterialArrival(order.ProductNo, materialIdCartonArray);
                if (materialArrivalCarton != null)
                {
                    assemblyMasterExportView.CartonMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalCarton.Date);
                }

                assemblyMasterExportView.AssemblyLine       = assemblyMaster.AssemblyLine;
                assemblyMasterExportView.AssemblyStartDate  = assemblyMaster.AssemblyStartDate;
                assemblyMasterExportView.AssemblyFinishDate = assemblyMaster.AssemblyFinishDate;
                assemblyMasterExportView.AssemblyQuota      = assemblyMaster.AssemblyQuota;
                assemblyMasterExportView.AssemblyBalance    = assemblyMaster.AssemblyBalance;

                SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault();
                if (sewingMaster != null)
                {
                    assemblyMasterExportView.SewingStartDate  = sewingMaster.SewingStartDate;
                    assemblyMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate;
                    assemblyMasterExportView.SewingBalance    = sewingMaster.SewingBalance;
                }
                else
                {
                    assemblyMasterExportView.SewingStartDate  = dtDefault;
                    assemblyMasterExportView.SewingFinishDate = dtDefault;
                    assemblyMasterExportView.SewingBalance    = "";
                }

                OutsoleMasterModel outsoleMaster = outsoleMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault();
                if (outsoleMaster != null)
                {
                    assemblyMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance;
                }
                else
                {
                    assemblyMasterExportView.OutsoleBalance = "";
                }

                SockliningMasterModel sockliningMaster = sockliningMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault();
                if (sockliningMaster != null)
                {
                    assemblyMasterExportView.InsoleBalance = sockliningMaster.InsoleBalance;
                    assemblyMasterExportView.InsockBalance = sockliningMaster.InsockBalance;
                }
                else
                {
                    assemblyMasterExportView.InsoleBalance = "";
                    assemblyMasterExportView.InsockBalance = "";
                }
                assemblyMasterExportViewList.Add(assemblyMasterExportView);
            }
        }