/// <summary> /// 获取訂單信息 /// </summary> /// <param name=></param> /// <returns></returns> public List <MODEL.doc_Order> GetOrderW(string yyyymm) { string sql = @" select customstylecode, totalcount , Packlisttotalcount,OrderDate from doc_Order where OrderDate=@OrderDate and CustomName='ASICS' and totalcount != Packlisttotalcount order by CustomStyleCode "; SqlParameter[] ps = { new SqlParameter("@OrderDate", yyyymm) }; DataTable dt = SqlHelper.ExcuteTable(sql, ps); List <MODEL.doc_Order> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_Order>(); foreach (DataRow row in dt.Rows) { MODEL.doc_Order c = new MODEL.doc_Order(); LoadDataToList1(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList(DataRow dr, MODEL.doc_Order order) { order.Guid = (Guid)SqlHelper.FromDbValue(dr["Guid"]); //GUiD order.Code = (string)SqlHelper.FromDbValue(dr["Code"]); order.Style = (string)SqlHelper.FromDbValue(dr["Style"]); order.Name = (string)SqlHelper.FromDbValue(dr["Name"]); //客户型体 order.Color = (string)SqlHelper.FromDbValue(dr["Color"]); order.TotalCount = (string)SqlHelper.FromDbValue(dr["TotalCount"]); order.Packlisttotalcount = (string)SqlHelper.FromDbValue(dr["Packlisttotalcount"]); order.CustomStyleCode = (string)SqlHelper.FromDbValue(dr["CustomStyleCode"]); //訂單 order.CustomName = (string)SqlHelper.FromDbValue(dr["CustomName"]); //客戶 order.CustomBuyName = (string)SqlHelper.FromDbValue(dr["CustomBuyName"]); //客戶買主 order.AimArea = (string)SqlHelper.FromDbValue(dr["AimArea"]); //目的地 order.GoodsTypeName = (string)SqlHelper.FromDbValue(dr["GoodsTypeName"]); order.CutNo = (string)SqlHelper.FromDbValue(dr["CutNo"]); // 客戶po order.OrderDate = (string)SqlHelper.FromDbValue(dr["OrderDate"]); order.ShipMentDate = (DateTime)SqlHelper.FromDbValue(dr["ShipMentDate"]); order.ProdDate = (string)SqlHelper.FromDbValue(dr["ProdDate"]); order.CustomPO = (string)SqlHelper.FromDbValue(dr["CustomPO"]); order.ManufactureOrder = (string)SqlHelper.FromDbValue(dr["ManufactureOrder"]); order.CartonBarcodeNeed = (string)SqlHelper.FromDbValue(dr["CartonBarcodeNeed"]); order.Type = (string)SqlHelper.FromDbValue(dr["Type"]); }
/// <summary> /// 获取訂單信息 /// </summary> ...................................and CustomName='ASICS' /// <param name=></param> /// <returns></returns> public List <MODEL.doc_Order> GetOrderOne(string customstylecode) { string sql = @" select Guid, Code,Style,Name,Color, customstylecode,CustomName,CustomBuyName,AimArea,GoodsTypeName,CutNo, TotalCount , Packlisttotalcount,OrderDate,ShipMentDate,ProdDate,CustomPO,ManufactureOrder,CartonBarcodeNeed,Type from doc_Order where CustomStyleCode=@CustomStyleCode "; SqlParameter[] ps = { new SqlParameter("@CustomStyleCode", customstylecode) }; DataTable dt = SqlHelper.ExcuteTable(sql, ps); List <MODEL.doc_Order> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_Order>(); foreach (DataRow row in dt.Rows) { MODEL.doc_Order c = new MODEL.doc_Order(); LoadDataToList(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// /// </summary> /// <param name=""></param> /// <returns></returns> public List <MODEL.doc_Order> SeeOrder(string orderdate, string customname, string name, string customstylecode, string custombuyname) { string sql = @" select CustomName,Name,Color,Type,Style,TotalCount,Code,CustomStyleCode,CustomBuyName,CartonBarcodeNeed from doc_Order "; 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 (custombuyname != "") { listWhere.Add(" CustomBuyName like @CustomBuyName "); listParameters.Add(new SqlParameter("@CustomBuyName", "%" + custombuyname + "%")); } if (listWhere.Count > 0) { string sqlWhere = string.Join(" and ", listWhere.ToArray()); sql = sql + " where " + sqlWhere + " order by CustomStyleCode "; } DataTable dt = SqlHelper.ExcuteTable(sql, listParameters.ToArray()); List <MODEL.doc_Order> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_Order>(); foreach (DataRow row in dt.Rows) { MODEL.doc_Order c = new MODEL.doc_Order(); LoadDataToList2(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList2(DataRow dr, MODEL.doc_Order order) { // CustomName,Name,Color,Type,Style,TotalCount,Code,CustomStyleCode,CustomBuyName order.CustomName = dr["CustomName"].ToString(); //客户名称 order.Name = (string)SqlHelper.FromDbValue(dr["Name"]); //客户型体 order.Color = (string)SqlHelper.FromDbValue(dr["Color"]); order.Type = (string)SqlHelper.FromDbValue(dr["Type"]); order.Style = (string)SqlHelper.FromDbValue(dr["Style"]); order.TotalCount = (string)SqlHelper.FromDbValue(dr["TotalCount"]); order.Code = (string)SqlHelper.FromDbValue(dr["Code"]); order.CartonBarcodeNeed = (string)SqlHelper.FromDbValue(dr["CartonBarcodeNeed"]); order.CustomStyleCode = (string)SqlHelper.FromDbValue(dr["CustomStyleCode"]); order.CustomBuyName = (string)SqlHelper.FromDbValue(dr["CustomBuyName"]); }
/// 增加订单 /// </summary> /// <param>"order"></param> /// <returns></returns> public int AddOrder(MODEL.doc_Order order) { return(ods.AddOrder(order)); }
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> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList1(DataRow dr, MODEL.doc_Order order) { order.TotalCount = (string)SqlHelper.FromDbValue(dr["TotalCount"]); order.Packlisttotalcount = (string)SqlHelper.FromDbValue(dr["Packlisttotalcount"]); order.CustomStyleCode = (string)SqlHelper.FromDbValue(dr["CustomStyleCode"]); //訂單 }
/// 增加订单 /// </summary> /// <param>"order"></param> /// <returns></returns> public int AddOrder(MODEL.doc_Order order) { //string sql = ""; string sql = @" insert into doc_Order(Guid, T_StyleCodeInfoGuid, AimArea,Name,Code,GoodsTypeName,CustomBuyName,CustomName,CustomStyleCode,ManufactureOrder,CustomPO, TotalCount,OrderDate,ProdDate,CutNo,ShipMentDate,Style,Color,CartonBarcodeNeed,Type) values(@Guid, @T_StyleCodeInfoGuid, @AimArea, @Name, @Code, @GoodsTypeName,@CustomBuyName,@CustomName, @CustomStyleCode,@ManufactureOrder,@CustomPO, @TotalCount, @OrderDate,@ProdDate, @CutNo,@ShipMentDate, @Style, @Color,@CartonBarcodeNeed,@Type)"; SqlParameter[] ps = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(order.Guid) }, new SqlParameter("@T_StyleCodeInfoGuid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(order.T_StyleCodeInfoGuid) }, new SqlParameter("@AimArea", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.AimArea) }, new SqlParameter("@Name", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.Name) }, new SqlParameter("@Code", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.Code) }, new SqlParameter("@GoodsTypeName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.GoodsTypeName) }, new SqlParameter("@CustomBuyName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CustomBuyName) }, new SqlParameter("@CustomName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CustomName) }, new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CustomStyleCode) }, new SqlParameter("@ManufactureOrder", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.ManufactureOrder) }, new SqlParameter("@CustomPO", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CustomPO) }, new SqlParameter("@TotalCount", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.TotalCount) }, new SqlParameter("@OrderDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.OrderDate) }, new SqlParameter("@ProdDate", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.ProdDate) }, new SqlParameter("@CutNo", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CutNo) }, new SqlParameter("@ShipMentDate", SqlDbType.DateTime) { Value = SqlHelper.ToDbValue(order.ShipMentDate) }, new SqlParameter("@Style", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.Style) }, new SqlParameter("@Color", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.Color) }, new SqlParameter("@CartonBarcodeNeed", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.CartonBarcodeNeed) }, new SqlParameter("@Type", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(order.Type) } }; return(SqlHelper.ExecuteNonQuery(sql, ps)); }