/// <summary> /// 用來確認內盒條碼 ,內盒尺碼,型體,配色 基本資料有沒有.... MARK NewCode /// </summary> /// <param name=></param> /// <returns></returns> public List <MODEL.doc_InnerBox> GetInnerfromOrder(string yyyymm) { string sql = @" select distinct Style,Color, b.Name Name, Size,CustomName from T_StyleCodeInfo b left join ( select SizeID, Size, T_StyleCodeInfoGuid from T_Sizi) c on b.Guid = c.T_StyleCodeInfoGuid left join( select style, code, NewCode,Color from doc_Style )e on e.Code = b.Code where b.OrderDate >=@OrderDate and size is not null and style is not null and color is not null order by b.Name, e.Color "; SqlParameter p = new SqlParameter("OrderDate", yyyymm); DataTable dt = SqlHelper.ExcuteTable(sql, p); List <MODEL.doc_InnerBox> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_InnerBox>(); foreach (DataRow row in dt.Rows) { MODEL.doc_InnerBox c = new MODEL.doc_InnerBox(); 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_InnerBox style) { style.Style = (String)SqlHelper.FromDbValue(dr["Style"]); style.Color = (String)SqlHelper.FromDbValue(dr["Color"]); style.Name = (String)SqlHelper.FromDbValue(dr["Name"]); style.Size = (String)SqlHelper.FromDbValue(dr["Size"]); style.CustomName = (String)SqlHelper.FromDbValue(dr["CustomName"]); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList(DataRow dr, MODEL.doc_InnerBox innerbox) { innerbox.InnerBarcode = dr["InnerBarcode"].ToString(); innerbox.StyleCode = dr["StyleCode"].ToString(); innerbox.Style = dr["Style"].ToString(); innerbox.Name = dr["Name"].ToString(); innerbox.Color = dr["Color"].ToString(); innerbox.Size = dr["Size"].ToString(); }
/// <summary> /// 加载行数据到对象--集合 /// </summary> /// <param name="dr"></param> /// <param name="classes"></param> public void LoadDataToList1(DataRow dr, MODEL.doc_InnerBox innerbox) { innerbox.InnerBarcode = (String)SqlHelper.FromDbValue(dr["InnerBarcode"]); innerbox.Name = (String)SqlHelper.FromDbValue(dr["Name"]); innerbox.Style = (String)SqlHelper.FromDbValue(dr["Style"]); innerbox.Color = (String)SqlHelper.FromDbValue(dr["Color"]); innerbox.Size = (String)SqlHelper.FromDbValue(dr["Size"]); innerbox.Type = (String)SqlHelper.FromDbValue(dr["Type"]); innerbox.NewCode = (String)SqlHelper.FromDbValue(dr["NewCode"]); }
/// <summary> /// 增加內盒條碼資料 , 內盒條碼使用掃描後 更新 /// </summary> /// <param name="addInnerBox"></param> /// <returns></returns> public int AddInnerBox(MODEL.doc_InnerBox addInnerBox) { string sql = ""; sql = @" insert into doc_InnerBox(Guid,InnerBarcode,StyleCode,Name,Style,Color,Size,Type,NewCode,CustomName) values(@Guid,@InnerBarcode,@StyleCode,@Name,@Style,@Color,@Size,@Type,@NewCode,@CustomName) "; SqlParameter[] ps = { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) { Value = SqlHelper.ToDbValue(addInnerBox.Guid) }, new SqlParameter("@InnerBarcode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.InnerBarcode) }, new SqlParameter("@StyleCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.StyleCode) }, new SqlParameter("@Name", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.Name) }, new SqlParameter("@Style", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.Style) }, new SqlParameter("@Color", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.Color) }, new SqlParameter("@Size", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.Size) }, new SqlParameter("@Type", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.Type) }, new SqlParameter("@NewCode", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.NewCode) }, new SqlParameter("@CustomName", SqlDbType.NVarChar) { Value = SqlHelper.ToDbValue(addInnerBox.CustomName) } }; return(SqlHelper.ExecuteNonQuery(sql, ps)); }
/// <summary> /// 获取所有班级信息 /// </summary> /// <param name="isDel"></param> /// <returns></returns> public List <MODEL.doc_InnerBox> GetAllInneBox(string innerbarcode) { string sql = "select * from doc_innerBox where InnerBarcode=@InnerBarcode "; SqlParameter p = new SqlParameter("InnerBarcode", innerbarcode); DataTable dt = SqlHelper.ExcuteTable(sql, p); List <MODEL.doc_InnerBox> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_InnerBox>(); foreach (DataRow row in dt.Rows) { MODEL.doc_InnerBox c = new MODEL.doc_InnerBox(); LoadDataToList(row, c); lists.Add(c); } } return(lists); }
/// <summary> /// 获取所有班级信息 /// </summary> /// <param name="isDel"></param> /// <returns></returns> public List <MODEL.doc_InnerBox> GetEmptyBox(string yyyymm) { string sql = " select * from doc_innerBox where NewCode=@NewCode and ( InnerBarcode='' or InnerBarcode is null ) "; SqlParameter p = new SqlParameter("NewCode", yyyymm); DataTable dt = SqlHelper.ExcuteTable(sql, p); List <MODEL.doc_InnerBox> lists = null; if (dt.Rows.Count > 0) { lists = new List <MODEL.doc_InnerBox>(); foreach (DataRow row in dt.Rows) { MODEL.doc_InnerBox c = new MODEL.doc_InnerBox(); LoadDataToList1(row, c); lists.Add(c); } } return(lists); }
public void getinfobybarcode(string scanno) { //外箱条码=14,12位(有100),内盒 13,12位(没有100) if (scanno.Length == 14 || (scanno.Length == 12 && scanno.Substring(0, 3) == "100")) { #region if 狀況 kk = 0; #region if (scanno.Length == 14) { cleansize(); lblNo.Text = ""; if (scanno.Substring(0, 3) == "001") { lblCarton.Text = scanno.Substring(2, 8); lblCartonNo.Text = scanno.Substring(10); lblStyle.Text = od.GetStyle(lblCarton.Text); } else { lblCarton.Text = scanno.Substring(0, 10); lblCartonNo.Text = scanno.Substring(10); lblStyle.Text = od.GetStyle(lblCarton.Text); } if (lblStyle.Text == "") { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow("内盒条码没有对应型体数据", 60); MessageBox.Show("请导入内盒条码型体"); frm.BackColor = System.Drawing.Color.BurlyWood; // MessageBox.Show("条码没有对应型体数据"); } else { lblColor.Text = od.GetColor(lblCarton.Text); } } #endregion //外箱100条码 12位 else if (scanno.Length == 12 && scanno.Substring(0, 3) == "100") { #region CLEANSIZE lblStyle.Text = ""; lblColor.Text = ""; lblSize1.Text = ""; lblSize1.BackColor = System.Drawing.Color.AliceBlue; lblSize2.Text = ""; lblSize2.BackColor = System.Drawing.Color.AliceBlue; lblSize3.Text = ""; lblSize3.BackColor = System.Drawing.Color.AliceBlue; lblSize4.Text = ""; lblSize4.BackColor = System.Drawing.Color.AliceBlue; lblSize5.Text = ""; lblSize5.BackColor = System.Drawing.Color.AliceBlue; lblSize6.Text = ""; lblSize6.BackColor = System.Drawing.Color.AliceBlue; lblSize7.Text = ""; lblSize7.BackColor = System.Drawing.Color.AliceBlue; lblSize8.Text = ""; lblSize8.BackColor = System.Drawing.Color.AliceBlue; lblSize9.Text = ""; lblSize9.BackColor = System.Drawing.Color.AliceBlue; lblSize10.Text = ""; lblSize10.BackColor = System.Drawing.Color.AliceBlue; lblSize11.Text = ""; lblSize11.BackColor = System.Drawing.Color.AliceBlue; lblSize12.Text = ""; lblSize12.BackColor = System.Drawing.Color.AliceBlue; kk = 1; #endregion cleansize lblNo.Text = ""; lblCarton.Text = scanno.Substring(0, 8); lblCartonNo.Text = scanno.Substring(8); lblStyle.Text = od.GetStyle(lblCarton.Text); #region if (lblStyle.Text == "") { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow(" 外箱条码没有对应型体数据", 60); MessageBox.Show("请导入订单外箱型体数据---IT小明"); frm.BackColor = System.Drawing.Color.BurlyWood; /// MessageBox.Show("条码没有对应型体数据"); // kk = 0; } else { lblColor.Text = od.GetColor(lblCarton.Text); } #endregion } #endregion if 狀況 } // 内盒条码扫描 else if (scanno.Length == 13 || (scanno.Length == 12 && scanno.Substring(0, 3) != "100")) { #region else if 內容 if (lblCarton.Text == "") { #region if (scanno.Substring(0, 3) == "454") { // msgDiv.MsgDivShow("哈哈哈",60); lblCarton.Text = scanno.Substring(0, scanno.Length); lblCartonNo.Text = scanno.Substring(9); List <MODEL.doc_InnerBox> temp = new List <MODEL.doc_InnerBox>(); temp = ib.GetAllInneBox(scanno); if (temp != null && temp.Count >= 1) { lblStyle.Text = temp[0].Name.ToString(); lblColor.Text = temp[0].Color.ToString(); } } else { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow("没有扫描外箱"); frm.BackColor = System.Drawing.Color.BurlyWood; } #endregion } // 内盒显示在这里 else { msgDiv.MsgDivHidden(); MODEL.doc_InnerBox newinnerbox = new MODEL.doc_InnerBox(); List <MODEL.doc_InnerBox> lists = new List <MODEL.doc_InnerBox>(); this.dgvBarcode.DataSource = ib.GetAllInneBox(scanno); lblNo.Text = kk.ToString(); tb13.AppendText(kk.ToString() + "--" + scanno + "\r\n"); lists = ib.GetAllInneBox(scanno); #region else 內容 if (lists == null) { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow("没有内盒商品条码资料请导入", 60); MessageBox.Show("请导入内盒条码型体----IE如中"); frm.BackColor = System.Drawing.Color.BurlyWood; } else { frm.BackColor = System.Drawing.Color.White; string size = lists[0].Size; #region //日本線掃描主要判斷 // 形体配色一样,内盒条码Jan 混入ean if (lblCarton.Text.Substring(0, 3) == "454") { //去掉型体,自然显示外箱内盒条码不正确 if (lists[0].InnerBarcode.Substring(0, 3) != "454") { lblStyle.Text = ""; } } if (lblStyle.Text == lists[0].Name && lblColor.Text == lists[0].Color) { innershow(kk, size); #region if (kk == 13) { if (lblSize1.Text == lblSize2.Text && lblSize1.Text == lblSize3.Text && lblSize1.Text == lblSize4.Text && lblSize1.Text == lblSize5.Text && lblSize1.Text == lblSize6.Text && lblSize1.Text == lblSize7.Text && lblSize1.Text == lblSize8.Text && lblSize1.Text == lblSize9.Text && lblSize1.Text == lblSize10.Text && lblSize1.Text == lblSize11.Text && lblSize1.Text == lblSize12.Text) { //触发拍照 getPhotos(); // cleansize(); lblNo.Text = "OK"; lblStyle.Text = ""; msgDiv.MsgDivShow("太棒了,刷条码成功", 60); frm.BackColor = System.Drawing.Color.DarkGreen; } else { // DialogResult resault = MessageBox.Show("混码箱请人工核对外箱上尺码数量与内盒数量再次确认"+ "\r\n" + "检查尺码正确 请按 ----------确定" + "\r\n" + " 检查尺码错误 请按 ----------------------------------取消" , "检查尺码", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); // cleansize(); lblNo.Text = ""; lblStyle.Text = ""; msgDiv.MsgDivShow("混码自行核對,不顯示綠色成功", 60); // frm.BackColor = System.Drawing.Color.DarkGreen; } } ; #endregion } else { if (scanno.Substring(0, 3) == "454") { msgDiv.MsgDivShow("更换内盒", 60); cleansize(); lblCarton.Text = scanno.Substring(0, 13); lblCartonNo.Text = scanno.Substring(9); List <MODEL.doc_InnerBox> temp = new List <MODEL.doc_InnerBox>(); temp = ib.GetAllInneBox(scanno); lblStyle.Text = temp[0].Name.ToString(); lblColor.Text = temp[0].Color.ToString(); } else { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow("内盒外箱条码型体不对", 60); MessageBox.Show("请更换正确条码型体内盒"); frm.BackColor = System.Drawing.Color.BurlyWood; }; }; #endregion //日本線掃描主要判斷 } #endregion else 內容 } #endregion else if 內容 } // if ,elseif 其他狀況 else { frm.BackColor = System.Drawing.Color.Yellow; msgDiv.MsgDivShow("内盒条码没有对应型体数据", 60); MessageBox.Show("请找IT小明查明原因"); frm.BackColor = System.Drawing.Color.BurlyWood; // MessageBox.Show("非14位外箱条码也非12,13位内盒条码"); } }
/// <summary> /// 增加內盒條碼資料 , 內盒條碼使用掃描後 更新 /// </summary> /// <param name="addStyle"></param> /// <returns></returns> public int AddInnerBox(MODEL.doc_InnerBox addInnerBox) { return(ibs.AddInnerBox(addInnerBox)); }
// 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() + "筆內盒資料新增"); }