/// <summary> /// /// </summary> /// <param name=></param> /// <returns></returns> public List <MODEL.doc_OrderSize> GetNoInnerBarcode(string yyyymm) { string sql = @" select CustomName,Name,Color,Size,Type from doc_OrderSize where InnerBarcode is null and OrderDate=@OrderDate and CustomName='ASICS' Group by CustomName,Name,Color,Size,Type Order by CustomName,Name ,Color,Size, Type "; SqlParameter[] ps = { new SqlParameter("@OrderDate", yyyymm) }; DataTable dt = SqlHelper.ExcuteTable(sql, ps); List <MODEL.doc_OrderSize> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_OrderSize>(); foreach (DataRow row in dt.Rows) { MODEL.doc_OrderSize c = new MODEL.doc_OrderSize(); LoadDataToList2(row, c); lists.Add(c); } } return(lists); }
private void button1_Click(object sender, EventArgs e) { MODEL.doc_OrderSize ods = new MODEL.doc_OrderSize(); odslist = odsm.GetNoInnerBarcode(YearMounth.Text); if (odslist == null) { MessageBox.Show("OK沒有新的內盒尺碼需要更新"); } else { for (int g = 0; g < odslist.Count; g++) { test.Clear(); string myinnerbarcode = odsm.GetInnerBarcode(odslist[g].Name, odslist[g].Color, odslist[g].Size, odslist[g].Type); if (myinnerbarcode == "") { MessageBox.Show("沒有內盒條碼資料"); } else { odsm.updateOrderSizeInnerBarcode(myinnerbarcode, odslist[g].Name, odslist[g].Color, odslist[g].Size, odslist[g].Type); test.AppendText(odslist[g].Name.ToString() + "\r\n" + odslist[g].Size.ToString() + "\r\n" + (g + 1).ToString() + "/" + odslist.Count.ToString()); } } MessageBox.Show("尺碼內盒條碼更新OK"); } }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList2(DataRow dr, MODEL.doc_OrderSize order) { order.CustomName = (string)SqlHelper.FromDbValue(dr["CustomName"]); order.Name = (string)SqlHelper.FromDbValue(dr["Name"]); order.Color = (string)SqlHelper.FromDbValue(dr["Color"]); order.Type = (string)SqlHelper.FromDbValue(dr["Type"]); order.Size = (string)SqlHelper.FromDbValue(dr["Size"]); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList(DataRow dr, MODEL.doc_OrderSize ordersize) { // --customName,Name,Color,Type,Size,Sizecount,Code,CustomStyleCode ordersize.CustomName = dr["CustomName"].ToString(); //客户名称 ordersize.Name = (string)SqlHelper.FromDbValue(dr["Name"]); //客户型体 ordersize.Color = (string)SqlHelper.FromDbValue(dr["Color"]); ordersize.Type = (string)SqlHelper.FromDbValue(dr["Type"]); ordersize.Size = (string)SqlHelper.FromDbValue(dr["Size"]); ordersize.SizeCount = (string)SqlHelper.FromDbValue(dr["SizeCount"]); ordersize.Code = (string)SqlHelper.FromDbValue(dr["Code"]); ordersize.CustomStyleCode = (string)SqlHelper.FromDbValue(dr["CustomStyleCode"]); }
/// <summary> /// /// </summary> /// <param name=""></param> /// <returns></returns> public List <MODEL.doc_OrderSize> SeeOrderSize(string orderdate, string customname, string name, string customstylecode) { string sql = @" select CustomName,Name,Color,Type,Size,Sizecount,Code,CustomStyleCode from doc_OrderSize "; List <string> listWhere = new List <string>(); List <SqlParameter> listParameters = new List <SqlParameter>(); if (orderdate != "") { listWhere.Add(" Orderdate=@Orderdate "); listParameters.Add(new SqlParameter("@Orderdate", orderdate)); } if (customname != "") { listWhere.Add(" CustomName like @CustomName "); listParameters.Add(new SqlParameter("@CustomName", "%" + customname + "%")); } if (name != "") { listWhere.Add(" Name like @Name "); listParameters.Add(new SqlParameter("@Name", "%" + name + "%")); } if (customstylecode != "") { listWhere.Add(" CustomStyleCode like @CustomStyleCode "); listParameters.Add(new SqlParameter("@CustomStyleCode", "%" + customstylecode + "%")); } if (listWhere.Count > 0) { string sqlWhere = string.Join(" and ", listWhere.ToArray()); sql = sql + " where " + sqlWhere + " order by CustomStyleCode,Size "; } DataTable dt = SqlHelper.ExcuteTable(sql, listParameters.ToArray()); List <MODEL.doc_OrderSize> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_OrderSize>(); foreach (DataRow row in dt.Rows) { MODEL.doc_OrderSize c = new MODEL.doc_OrderSize(); LoadDataToList(row, c); lists.Add(c); } } return(lists); }
private void btnOrderIn_Click(object sender, EventArgs e) { listbuyer = null; listbuyer = bm.GetlBuyerE(YearMounth.Text); // if (listbuyer != null && listbuyer.Count() > 0) if (listbuyer != null && listbuyer.Count() > 0) { MessageBox.Show("有新的目的地,請先到客戶買主窗口新增"); return; } else { } /////-----Order ///* int aa = 0; todlist = tod.GetAllorder(YearMounth.Text); if (todlist == null) { MessageBox.Show("沒有訂單資料接轉,請找IT"); } for (int a = 0; a < todlist.Count; a++) { MODEL.doc_Order od = new MODEL.doc_Order(); test.Clear(); od.Guid = Guid.NewGuid(); od.T_StyleCodeInfoGuid = todlist[a].Guid; od.AimArea = todlist[a].AimArea; od.Name = todlist[a].Name; od.Code = todlist[a].Code; od.GoodsTypeName = todlist[a].GoodsTypeName; od.CustomBuyName = todlist[a].CustomBuyName; if (od.CustomBuyName == "") { if (od.AimArea == "KOBE") { od.CustomBuyName = "TRASICS"; } else if (od.AimArea == "VENICE") { od.CustomBuyName = "GEOX"; } else { } } od.CustomName = todlist[a].CustomName; od.CustomStyleCode = todlist[a].CustomStyleCode; od.ManufactureOrder = todlist[a].ManufactureOrder; od.CustomPO = todlist[a].CustomPO; od.TotalCount = todlist[a].TotalCount; od.OrderDate = todlist[a].OrderDate; od.ProdDate = todlist[a].OrderDate; od.CutNo = todlist[a].CutNo; od.ShipMentDate = todlist[a].ShipMentDate; ///............... string[] mycode = todlist[a].Code.Split('/'); od.Style = mycode[0].Trim(); //判断如果没有/ 那么长度就会为1(一段) if (mycode.Length > 1) { od.Color = mycode[1].Trim(); } ; od.CartonBarcodeNeed = plm.GetBuyerCartonBarcodeNeed(od.CustomBuyName, od.CustomName.ToString(), od.AimArea); od.Type = plm.GetBuyertype(od.CustomBuyName, od.CustomName.ToString(), od.AimArea); if (plm.GetBuyertype(od.CustomBuyName, od.CustomName.ToString(), od.AimArea) == null) { MessageBox.Show("CustomBuyName:" + od.CustomBuyName + ",Destination:" + od.AimArea + "為空請查doc_Buyer"); return; } if (odm.IsCustomStyleCodeExisits(todlist[a].CustomStyleCode) < 1) { //// 先转基本的订单,计划日期,产量,TYPE都使用更新 odm.AddOrder(od); aa++; } test.AppendText("订单" + "\r\n" + od.CustomStyleCode + "\r\n" + (a + 1).ToString() + "/" + todlist.Count.ToString()); } MessageBox.Show("总共有" + aa.ToString() + "笔订单新增"); //沒有訂單新增,下面就不用跑了 if (aa == 0) { return; } ///*/ //// ------------ OderSize odlist = odm.GetOrder(YearMounth.Text); this.dgvOrderSize.DataSource = odlist; int dd = 0; for (int f = 0; f < odlist.Count; f++) { MODEL.doc_OrderSize ods = new MODEL.doc_OrderSize(); test.Clear(); ods.docOrderGuid = odlist[f].Guid; ods.CustomName = odlist[f].CustomName; ods.CustomStyleCode = odlist[f].CustomStyleCode; ods.TotalCount = odlist[f].TotalCount; ods.Code = odlist[f].Code; ods.Name = odlist[f].Name; ods.Color = odlist[f].Color; ods.OrderDate = odlist[f].OrderDate; ods.Type = odlist[f].Type; tsslist = tsm.GetTSize(ods.CustomStyleCode); for (int d = 0; d < tsslist.Count; d++) { test.Clear(); ods.Guid = Guid.NewGuid(); ods.Size = tsslist[d].Size; ods.TsizeGuid = tsslist[d].Guid; ods.SizeCount = tsslist[d].Ccount; if (ods.Color != null && ods.Type != null) { ods.InnerBarcode = plm.GetInnerBarcode(ods.Name, ods.Color, ods.Size, ods.Type); } if (odsm.IsOrderSizeExisits(ods.CustomStyleCode, ods.Size) < 1) { odsm.AddOrderSize(ods); dd++; } test.AppendText(ods.CustomStyleCode + "\r\n" + (d + 1).ToString() + "/" + tsslist.Count + "\r\n" + (f + 1).ToString() + "/" + odlist.Count.ToString()); } } MessageBox.Show("总共有" + dd.ToString() + "笔订单尺碼新增"); }
/// 增加订单 /// </summary> /// <param>"order"></param> /// <returns></returns> public int AddOrderSize(MODEL.doc_OrderSize ordersize) { return(oss.AddOrderSize(ordersize)); }
/// 增加订单 /// </summary> /// <param>"order"></param> /// <returns></returns> public int AddOrderSize(MODEL.doc_OrderSize ordersize) { //string sql = ""; string sql = @" insert into doc_OrderSize(Guid, TsizeGuid, docOrderGuid,CustomName,CustomStyleCode,TotalCount,Code,Name,Color,OrderDate,Size,SizeCount, Type,InnerBarcode) values(@Guid, @TsizeGuid, @docOrderGuid,@CustomName,@CustomStyleCode, @TotalCount, @Code,@Name,@Color, @OrderDate,@Size,@SizeCount, @Type, @InnerBarcode)"; SqlParameter[] ps = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(ordersize.Guid) }, new SqlParameter("@TsizeGuid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(ordersize.TsizeGuid) }, new SqlParameter("@docOrderGuid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(ordersize.docOrderGuid) }, new SqlParameter("@CustomName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.CustomName) }, new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.CustomStyleCode) }, new SqlParameter("@TotalCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.TotalCount) }, new SqlParameter("@Code", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.Code) }, new SqlParameter("@Name", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.Name) }, new SqlParameter("@Color", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.Color) }, new SqlParameter("@OrderDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.OrderDate) }, new SqlParameter("@Size", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.Size) }, new SqlParameter("@SizeCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.SizeCount) }, new SqlParameter("@Type", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.Type) }, new SqlParameter("@InnerBarcode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(ordersize.InnerBarcode) } }; return(SqlHelper.ExecuteNonQuery(sql, ps)); }