/// <summary> /// 從訂單資料抓出來型體尺碼訊息 /// </summary> /// <param name=></param> /// <returns></returns> public List <MODEL.doc_StyleSize> GetStyleSizefromOrder(string yyyymm) { string sql = @" select StyleBase, Style , Size ,min(OrderDate) OrderDate from ( select distinct Style,StyleBase,a.Name,d.Size,d.SizeID, a.OrderDate from doc_StyleBase a left join( select b.Name ,c.Size,OrderDate,c.SizeID from T_StyleCodeInfo b right join ( select SizeID, Size, T_StyleCodeInfoGuid from T_Sizi ) c on b.Guid = c.T_StyleCodeInfoGuid ) d on a.Name=d.Name )g where OrderDate>=@OrderDate Group by StyleBase,Style,g.Size "; SqlParameter p = new SqlParameter("OrderDate", yyyymm); DataTable dt = SqlHelper.ExcuteTable(sql, p); List <MODEL.doc_StyleSize> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_StyleSize>(); foreach (DataRow row in dt.Rows) { MODEL.doc_StyleSize c = new MODEL.doc_StyleSize(); LoadDataToList(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList(DataRow dr, MODEL.doc_StyleSize stylesize) { stylesize.Style = (String)SqlHelper.FromDbValue(dr["Style"]); stylesize.StyleBase = (String)SqlHelper.FromDbValue(dr["StyleBase"]); stylesize.Size = (String)SqlHelper.FromDbValue(dr["Size"]); stylesize.OrderDate = (String)SqlHelper.FromDbValue(dr["OrderDate"]); }
/// <summary> /// /// </summary> /// <param name=></param> /// <returns></returns> public List <MODEL.doc_StyleSize> GetAllStyleSize1(string yyyymm) { string sql = @" select * from doc_StyleSize where OrderDate=@OrderDate "; SqlParameter[] ps = { new SqlParameter("@OrderDate", yyyymm) }; DataTable dt = SqlHelper.ExcuteTable(sql, ps); List <MODEL.doc_StyleSize> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_StyleSize>(); foreach (DataRow row in dt.Rows) { MODEL.doc_StyleSize c = new MODEL.doc_StyleSize(); LoadDataToList1(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// 增加人员信息 /// </summary> /// <param name="addStyle"></param> /// <returns></returns> public int AddStyleSize(MODEL.doc_StyleSize addStyleSize) { string sql = ""; sql = @" insert into doc_StyleSize(Guid,Style,StyleBase,OrderDate,Section,Size,BoxSize,Weight,L,W,H ,Unit,NewCode) values(@Guid,@Style,@StyleBase,@OrderDate,@Section,@Size,@BoxSize,@Weight,@L,@W,@H ,@Unit,@NewCode) " ; SqlParameter[] ps = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(addStyleSize.Guid) }, new SqlParameter("@Style", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.Style) }, new SqlParameter("@StyleBase", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.StyleBase) }, new SqlParameter("@OrderDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.OrderDate) }, new SqlParameter("@Section", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.Section) }, new SqlParameter("@Size", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.Size) }, new SqlParameter("@BoxSize", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.BoxSize) }, new SqlParameter("@Unit", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.Unit) }, new SqlParameter("@Weight", SqlDbType.Float) { Value = SqlHelper.ToDbValue(addStyleSize.Weight) }, new SqlParameter("@Range", SqlDbType.Float) { Value = SqlHelper.ToDbValue(addStyleSize.Range) }, new SqlParameter("@L", SqlDbType.Float) { Value = SqlHelper.ToDbValue(addStyleSize.L) }, new SqlParameter("@W", SqlDbType.Float) { Value = SqlHelper.ToDbValue(addStyleSize.W) }, new SqlParameter("@H", SqlDbType.Float) { Value = SqlHelper.ToDbValue(addStyleSize.H) }, new SqlParameter("@NewCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addStyleSize.NewCode) } }; return(SqlHelper.ExecuteNonQuery(sql, ps)); }
/// <summary> /// 增加人员信息 /// </summary> /// <param name="addStyle"></param> /// <returns></returns> public int AddStyleSize(MODEL.doc_StyleSize addStyleSize) { return(ss.AddStyleSize(addStyleSize)); }
private void btnALLStyle_Click(object sender, EventArgs e) { #region ----------------StyleBase int aa = 0; ///* // 从订单中提出形体大类需要的资讯 ,使用唯一的Code 工厂型体捉出订单中大类的其他栏位 sblist = od.GetOrdertolStyle(YearMounth.Text); MODEL.doc_StyleBase sb = new MODEL.doc_StyleBase(); for (int k = 0; k < sblist.Count; k++) { test.Clear(); sb.Guid = System.Guid.NewGuid(); sb.Style = sblist[k].Style; sb.StyleBase = sblist[k].StyleBase; sb.Name = sblist[k].Name; sb.CustomName = sblist[k].CustomName; // sb.CustomNameS = sblist[k].CustomNameS; sb.GoodsTypeName = sblist[k].GoodsTypeName; sb.ModelNo = sblist[k].ModelNo; sb.RBcode = sblist[k].RBcode; sb.MDcode = sblist[k].MDcode; sb.Editionhandle = sblist[k].Editionhandle; sb.Innor = sblist[k].Editionhandle; sb.OrderDate = sblist[k].OrderDate; sb.NewCode = sblist[k].NewCode; test.AppendText("型体大类" + "\r\n" + sb.Style + sb.OrderDate + "\r\n" + (k + 1).ToString() + "/" + sblist.Count.ToString()); if (sbm.IsStyleBaseExisits(sblist[k].Name) < 1) { // MessageBox.Show("自动增加" + sb.Name); sbm.AddStyleBase(sb); aa = aa + 1; } ; } //*/ MessageBox.Show(aa.ToString() + "筆新型體新增"); #endregion #region ----- add StyleBase newcode ///* BLL.doc_StyleBaseManager sbm1 = new BLL.doc_StyleBaseManager(); sblist1 = sbm.GetAllStyleBase(); for (int l = 0; l < sblist1.Count; l++) { test.Clear(); // MessageBox.Show(sblist1[l].Name); string mycode = ""; mycode = sbm.GetSBNewCode(YearMounth.Text, sblist1[l].Name); test.AppendText("型体日期" + "\r\n" + mycode + "\r\n" + (l + 1).ToString() + "/" + sblist1.Count.ToString()); sbm1.updateStylebaseNewCode(sblist1[l].Name, mycode); } sblist1 = sbm.GetAllStyleBase(); this.dgvStyleBase.DataSource = sblist1; ///*/ #endregion -----end add new code #region ----------------Style // /* int myadd = 0; odlist = od.GetAllCode(YearMounth.Text); List <MODEL.doc_Style> lists = null; lists = new List <MODEL.doc_Style>(); for (int b = 0; b < odlist.Count; b++) { test.Clear(); MODEL.doc_Style c = new MODEL.doc_Style(); c.Code = odlist[b].Code; string[] mycode = odlist[b].Code.Split('/'); c.Style = mycode[0].Trim(); c.Guid = new Guid(); //判断如果没有/ 那么长度就会为1(一段) // if (odlist[j].Code.Length > mycode[0].Length) if (mycode.Length > 1) { c.Color = mycode[1].Trim(); } ; c.OrderDate = odlist[b].OrderDate; test.AppendText("型体配色" + "\r\n" + "c.Style" + "\r\n" + (b + 1).ToString() + "/" + odlist.Count.ToString()); lists.Add(c); if (sm.IsCodeExisits(odlist[b].Code) < 1) { sm.AddStyle(c); myadd++; } } MessageBox.Show(myadd.ToString() + "筆新配色新增"); //*/ #endregion #region ----- add style newcode ///* BLL.doc_StyleManager sm1 = new BLL.doc_StyleManager(); slist1 = sm1.GetAllStyle(); for (int c = 0; c < slist1.Count; c++) { test.Clear(); // MessageBox.Show(sblist1[l].Name); string mycode1 = ""; mycode1 = sm.GetSNewCode(YearMounth.Text, slist1[c].Code); test.AppendText("型体配色日期" + "\r\n" + mycode1 + "\r\n" + (c + 1).ToString() + "/" + slist1.Count.ToString()); sm1.updateStyleNewCode(slist1[c].Code, mycode1); } //*/ #endregion -----end add new code #region -------stylesize int sscount = 0; //* sslist = null; sslist = ssm.GetStyleSizefromOrder(YearMounth.Text); List <MODEL.doc_StyleSize> sslists = null; sslists = new List <MODEL.doc_StyleSize>(); for (int a = 0; a < sslist.Count; a++) { test.Clear(); MODEL.doc_StyleSize ss = new MODEL.doc_StyleSize(); ss.Guid = System.Guid.NewGuid(); ss.Style = sslist[a].Style; ss.StyleBase = sslist[a].StyleBase; // 取消sStyleBase ss.OrderDate = sslist[a].OrderDate; // 取消OrderDate 由於Code 不規範 (有些中間會有空格) ,所以OrderDate會多筆 ss.Size = sslist[a].Size; ss.NewCode = ""; ss.BoxSize = ""; ss.Section = ""; ss.Unit = "cm"; ss.Weight = 0; ss.Range = null; ss.L = null; ss.W = null; ss.H = null; test.AppendText("型体尺码" + "\r\n" + ss.Style + "\r\n" + (a + 1).ToString() + "/" + sslist.Count.ToString()); sslists.Add(ss); if (ssm.IsStyleSizeExisits(ss.Style, ss.Size) < 1) { ssm.AddStyleSize(ss); sscount++; } ; sslists.Clear(); } // */ MessageBox.Show(sscount.ToString() + "筆型體尺碼新增"); #endregion #region ----- add stylesize new code ///* BLL.doc_StyleSIzeManager ssm1 = new BLL.doc_StyleSIzeManager(); sslist1 = ssm1.GetAllStyleSize(); for (int c = 0; c < sslist1.Count; c++) { test.Clear(); // MessageBox.Show(sblist1[l].Name); string mycode2 = ""; mycode2 = ssm1.GetSBNewCodeToSS(YearMounth.Text, sslist1[c].Style); test.AppendText("型体尺码日期" + "\r\n" + mycode2 + "\r\n" + (c + 1).ToString() + "/" + sslist1.Count.ToString()); ssm1.updateStyleSizeNewCode(sslist1[c].Style, mycode2); } //*/ MessageBox.Show("更新完毕"); #endregion -----end add stylesize new code }
// BLL.doc_StyleBaseManager stm = new BLL.doc_StyleBaseManager(); private void btnALLStyle_Click(object sender, EventArgs e) { //----------------StyleBase // 从订单中提出形体大类需要的资讯 ,使用唯一的Code 工厂型体捉出订单中大类的其他栏位 stylist = od.GetOrdertolStyle(YearMounth.Text); MODEL.doc_StyleBase sb = new MODEL.doc_StyleBase(); int aa = 0; for (int k = 0; k < stylist.Count; k++) { test.Clear(); sb.Guid = System.Guid.NewGuid(); sb.Style = stylist[k].Style; sb.StyleBase = stylist[k].StyleBase; sb.Name = stylist[k].Name; sb.CustomName = stylist[k].CustomName; sb.GoodsTypeName = stylist[k].GoodsTypeName; sb.ModelNo = stylist[k].ModelNo; sb.RBcode = stylist[k].RBcode; sb.MDcode = stylist[k].MDcode; sb.Editionhandle = stylist[k].Editionhandle; sb.Innor = stylist[k].Editionhandle; sb.OrderDate = stylist[k].OrderDate; sb.NewCode = stylist[k].NewCode; test.AppendText("型体大类" + "\r\n" + sb.Style + sb.OrderDate + "\r\n" + (k + 1).ToString() + "/" + stylist.Count.ToString()); if (sbm.IsStyleBaseExisits(stylist[k].Name) < 1) { // MessageBox.Show("自动增加" + sb.Name); sbm.AddStyleBase(sb); aa = aa + 1; } ; } MessageBox.Show(aa.ToString() + "筆新型體新增"); // List<MODEL.doc_StyleBase> stybase = null; // stybase = stm.GetAllStyleBase(); // this.dgvStyleBase.DataSource = stybase; //----------------Style int myadd = 0; odlist = od.GetAllCode(YearMounth.Text); List <MODEL.doc_Style> lists = null; lists = new List <MODEL.doc_Style>(); for (int j = 0; j < odlist.Count; j++) { test.Clear(); MODEL.doc_Style c = new MODEL.doc_Style(); c.Code = odlist[j].Code; string[] mycode = odlist[j].Code.Split('/'); c.Style = mycode[0].Trim(); c.Guid = new Guid(); //判断如果没有/ 那么长度就会为1(一段) // if (odlist[j].Code.Length > mycode[0].Length) if (mycode.Length > 1) { c.Color = mycode[1].Trim(); } ; c.OrderDate = odlist[j].OrderDate; test.AppendText("型体" + "\r\n" + c.Style + c.OrderDate + "\r\n" + (j + 1).ToString() + "/" + odlist.Count.ToString()); lists.Add(c); if (sm.IsCodeExisits(odlist[j].Code) < 1) { sm.AddStyle(c); myadd++; } } MessageBox.Show(myadd.ToString() + "筆新配色新增"); //-------stylesize sslist = null; sslist = ssm.GetStyleSizefromOrder(YearMounth.Text); List <MODEL.doc_StyleSize> sslists = null; sslists = new List <MODEL.doc_StyleSize>(); int sscount = 0; for (int j = 0; j < sslist.Count; j++) { test.Clear(); MODEL.doc_StyleSize ss = new MODEL.doc_StyleSize(); ss.Guid = System.Guid.NewGuid(); ss.Style = sslist[j].Style; ss.StyleBase = sslist[j].StyleBase; // 取消sStyleBase ss.OrderDate = sslist[j].OrderDate; // 取消OrderDate 由於Code 不規範 (有些中間會有空格) ,所以OrderDate會多筆 ss.Size = sslist[j].Size; ss.NewCode = ""; ss.BoxSize = ""; ss.Section = ""; ss.Unit = "cm"; ss.Weight = null; ss.Range = null; ss.L = null; ss.W = null; ss.H = null; test.AppendText("型体尺码" + "\r\n" + ss.Style + ss.Size + "\r\n" + (j + 1).ToString() + "/" + sslist.Count.ToString()); sslists.Add(ss); if (ssm.IsStyleSizeExisits(ss.Style, ss.Size) < 1) { ssm.AddStyleSize(ss); sscount++; } ; sslists.Clear(); } MessageBox.Show(sscount.ToString() + "筆型體尺碼新增"); //------- inneer Box //獲得該月訂單年月的型體尺碼數量 solist = null; solist = ibm.GetInnerfromOrder(YearMounth.Text); // MessageBox.Show(solist.Count.ToString()); string show = solist.Count.ToString(); int ibcount = 0; List <MODEL.doc_InnerBox> iblists = null; iblists = new List <MODEL.doc_InnerBox>(); // doc_innorbox 沒有尺碼的增加 ,使用 name , size, color 判斷 for (int j = 0; j < solist.Count; j++) { test.Clear(); MODEL.doc_InnerBox ib = new MODEL.doc_InnerBox(); ib.Guid = System.Guid.NewGuid(); ib.InnerBarcode = ""; ib.Name = solist[j].Name.Trim(); ib.Style = solist[j].Style.Trim(); ib.Color = solist[j].Color.Trim(); ib.Size = solist[j].Size.Trim(); test.AppendText("内盒资料" + "\r\n" + ib.Name + ib.Color + ib.Size + "\r\n" + (j + 1).ToString() + "/" + solist.Count.ToString()); ib.CustomName = solist[j].CustomName; ib.Type = ""; ib.StyleCode = solist[j].Name + "." + solist[j].Color; ib.NewCode = ""; iblists.Add(ib); if (ibm.IsInnerBoxExisits(ib.Name, ib.Color, ib.Size) < 1) { ibm.AddInnerBox(ib); ibcount++; } } MessageBox.Show(ibcount.ToString() + "筆內盒資料新增"); }