Exemplo n.º 1
0
        /// <summary>
        /// 获取該掃描明細的訊息
        /// </summary>
        /// <param name=></param>
        /// <returns></returns>
        public List <MODEL.doc_PackListScan> GetPackListScan(string cartonbarcode)
        {
            string sql = @"
        select  * 
        from doc_PackListScan
        where CartonBarcode=@CartonBarcode order by ScanNO

                            ";

            SqlParameter[] ps =
            {
                new SqlParameter("@CartonBarcode", cartonbarcode)
            };

            DataTable dt = SqlHelper.ExcuteTable(sql, ps);
            List <MODEL.doc_PackListScan> lists = null;

            if (dt.Rows.Count > 0)
            {
                lists = new List <MODEL.doc_PackListScan>();
                foreach (DataRow row in dt.Rows)
                {
                    MODEL.doc_PackListScan c = new MODEL.doc_PackListScan();
                    LoadDataToList(row, c);
                    lists.Add(c);
                }
            }
            return(lists);
        }
Exemplo n.º 2
0
        /// </summary>
        /// <param>"order"></param>
        /// <returns></returns>
        public int AddPackList(MODEL.doc_PackListScan packlist)
        {
            string sql = @"
              insert into doc_PackListScan(Guid,CartonBarcode,InnerBarcode,ScanTime,SizeName,CustomStyleCode,OrderDate,ScanCount,ScanNO,ScanOut,Part)
        values(@Guid,@CartonBarcode,@InnerBarcode,@ScanTime,@SizeName,@CustomStyleCode,@OrderDate,@ScanCount,@ScanNO,@ScanOut,@Part)";

            SqlParameter[] ps =
            {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier)
                {
                    Value = SqlHelper.ToDbValue(packlist.Guid)
                },
                new SqlParameter("@CartonBarcode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.CartonBarcode)
                },
                new SqlParameter("@InnerBarcode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.InnerBarcode)
                },
                new SqlParameter("@ScanTime", SqlDbType.DateTime)
                {
                    Value = SqlHelper.ToDbValue(packlist.ScanTime)
                },
                new SqlParameter("@SizeName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.SizeName)
                },
                new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.CustomStyleCode)
                },
                new SqlParameter("@OrderDate", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.OrderDate)
                },
                new SqlParameter("@ScanCount", SqlDbType.Int)
                {
                    Value = SqlHelper.ToDbValue(packlist.ScanCount)
                },
                new SqlParameter("@ScanNO", SqlDbType.Int)
                {
                    Value = SqlHelper.ToDbValue(packlist.ScanNO)
                },
                new SqlParameter("@ScanOut", SqlDbType.Int)
                {
                    Value = SqlHelper.ToDbValue(packlist.ScanOut)
                },
                new SqlParameter("@Part", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(packlist.Part)
                }
            };
            return(SqlHelper.ExecuteNonQuery(sql, ps));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 加载行数据到对象--集合
 /// </summary>
 /// <param name="dr"></param>
 /// <param name="classes"></param>
 public void LoadDataToList1(DataRow dr, MODEL.doc_PackListScan pscan)
 {
     pscan.CartonBarcode   = (string)SqlHelper.FromDbValue(dr["CartonBarcode"]);
     pscan.InnerBarcode    = (string)SqlHelper.FromDbValue(dr["InnerBarcode"]);
     pscan.CustomStyleCode = (string)SqlHelper.FromDbValue(dr["CustomStyleCode"]);
     pscan.SizeName        = (string)SqlHelper.FromDbValue(dr["SizeName"]);
     pscan.ScanTime        = (DateTime)SqlHelper.FromDbValue(dr["ScanTime"]);
     pscan.OrderDate       = (string)SqlHelper.FromDbValue(dr["OrderDate"]);
     pscan.ScanCount       = (int)SqlHelper.FromDbValue(dr["ScanCount"]);
     pscan.ScanNO          = (int)SqlHelper.FromDbValue(dr["ScanNO"]);
     pscan.Part            = (string)SqlHelper.FromDbValue(dr["Part"]);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 加载行数据到对象--集合
 /// </summary>
 /// <param name="dr"></param>
 /// <param name="classes"></param>
 public void LoadDataToList(DataRow dr, MODEL.doc_PackListScan pscan)
 {
     pscan.SizeName = (string)SqlHelper.FromDbValue(dr["SizeName"]);
     pscan.ScanNO   = (int)SqlHelper.FromDbValue(dr["ScanNO"]);
 }
Exemplo n.º 5
0
 /// </summary>
 /// <param>"order"></param>
 /// <returns></returns>
 public int AddPackList(MODEL.doc_PackListScan packlistscan)
 {
     return(plss.AddPackList(packlistscan));
 }
Exemplo n.º 6
0
 private void scanInner(string scanno)
 {
     //dpllist = null;
     MODEL.doc_PackListScan dpls = new MODEL.doc_PackListScan();
     dpllist = dplm.GetInnerBarcode(scanno, lblCarton.Text);
     // this.dgvBarcode.DataSource = dpllist;
     if (dpllist != null)
     {
         if (lblNo.Text == "OK")
         {
             msgDiv.MsgDivShow(" 已經刷好了", 60);
             return;
         }
         else
         {
             frm.BackColor        = System.Drawing.Color.White;
             dpls.Guid            = Guid.NewGuid();
             dpls.CartonBarcode   = lblCarton.Text;
             dpls.InnerBarcode    = scanno;
             dpls.ScanTime        = DateTime.Now;
             dpls.SizeName        = dpllist[0].SizeName;
             dpls.CustomStyleCode = dpllist[0].CustomStyleCode;
             dpls.OrderDate       = dpllist[0].OrderDate;
             dpls.ScanCount       = 1;
             string hname = Dns.GetHostName(); //得到本机的主机名
             dpls.Part = "QA" + "." + hname;
             scannolist.Add(scanno);
             // sizeCount 箱的size号码
             int sizeCount = dplm.GetPackListSizeCount(dpls.CartonBarcode, dpls.InnerBarcode);
             Dictionary <string, int> list = new Dictionary <string, int>();
             for (int i = 0; i < scannolist.Count; i++)
             {
                 if (list.ContainsKey(scannolist[i]))
                 {
                     list[scannolist[i]]++; //相同元素值加1 相同元素个数加1
                 }
                 else
                 {
                     list.Add(scannolist[i], 1);//加入不同元素 值不相等
                 }
             }
             int msscanno = 0;
             for (int j = 0; j < list.Count; j++)
             {
                 msscanno = list[scanno];
                 if (msscanno > sizeCount)
                 {
                     MessageBox.Show("該外箱的" + dpls.SizeName + "號數量已經刷滿");
                     return;
                 }
             }
             dpls.ScanOut = msscanno;
             int lblnostr = 0;
             if (lblNo.Text == "0" || lblNo.Text == "")
             {
                 lblnostr = 0;
             }
             else
             {
                 lblnostr = int.Parse(lblNo.Text);
             }
             int scancount = lblnostr + 1;
             lblNo.Text  = scancount.ToString();//
             dpls.ScanNO = scancount;
             //  dplsm.AddPackList(dpls);
             innerMark(scancount, dpllist[0].SizeName);
             int mycount = (int)dpllist[0].BarcodeCount + 1; // 下一筆
             int mtotal  = dplm.GetPackListCartonCount(dpls.CartonBarcode);
             if (mtotal == scancount)
             {
                 lblNo.Text    = "OK";
                 lblStyle.Text = "";
                 msgDiv.MsgDivShow("太棒了,刷条码成功", 60);
                 frm.BackColor  = System.Drawing.Color.DarkGreen;
                 txtPwd.Enabled = false;
             }
         };
     }
     else
     {
         //該外箱沒有內盒的條碼,再判斷是否為別的外箱條碼.
         if (dplm.IsCartonBarcodetExisits(scanno) >= 1)
         {                    //新外箱
             if (lblNo.Text != "" && lblNo.Text != "0")
             {
                 MessageBox.Show("请先刷完本箱、或按\"刷新箱重新刷\"按钮之后再换箱");
                 return;
             }
             else
             {
                 scanCarton(scanno);
             }
         }
         else
         {
             MessageBox.Show("非此外箱内盒", "错误了", MessageBoxButtons.OK, MessageBoxIcon.Error);
             frm.BackColor  = System.Drawing.Color.DarkRed;
             txtPwd.Enabled = false;
         }
     }
 }