Beispiel #1
0
        /// <summary>
        /// Tim thung hang bi thieu tren pallete - M203S01
        /// </summary>
        /// <param name="boxes"></param>
        /// <returns></returns>
        public string PrintBoxFoundInPallete(List <string> boxes)
        {
            try
            {
                List <BoxNotExist> printList = new List <BoxNotExist>();
                string             date      = DateTime.Now.ToString("yyyyMMdd");
                string             time      = DateTime.Now.ToString("hhmmss");
                string             strNotIn  = "'" + boxes.Aggregate((a, b) => a + "', '" + b) + "'";

                DataTable data = uow.App200Repo.GetAllBoxNotInPallete(strNotIn, boxes.FirstOrDefault());
                uow.App200Repo.DeleteBoxNotInPallete(boxes.FirstOrDefault());

                foreach (DataRow row in data.Rows)
                {
                    DataTable dt          = uow.App200Repo.GetBoxInfoByBoxJob(row["box_no"].ToString());
                    string    destination = dt.Rows[0]["cust_user_main_stk_loc"].ToString().Trim();

                    BoxNotExist temp = new BoxNotExist()
                    {
                        BoxNo       = row["box_no"].ToString(),
                        Item        = dt.Rows[0]["item"].ToString(),
                        LotNo       = dt.Rows[0]["lot"].ToString(),
                        Qty         = Convert.ToInt32(dt.Rows[0]["qty"].ToString()),
                        PalleteNo   = dt.Rows[0]["pallete_no"].ToString(),
                        EntryDate   = date,
                        EntryTime   = time,
                        Destination = destination.Length == 4 ? destination.Substring(1, 1) + destination.Substring(3, 1) : destination
                    };

                    printList.Add(temp);

                    int ret = uow.App200Repo.InsertToBoxNotInPallete(temp);
                    if (ret < 0)
                    {
                        uow.Rollback();
                        return(AppCommon.ShowErrorMsg(17));
                    }
                }

                uow.Commit();
                List <BoxNotExist> printTemp = printList.OrderBy(p => p.Item).ThenBy(p => p.LotNo).ThenBy(p => p.BoxNo).ToList <BoxNotExist>();

                Printer <BoxNotExist> .PrintData("BOXNOTINPALLETE", printTemp);

                return(AppCommon.ShowOkMsg(0));
            }
            catch (Exception ex)
            {
                using (StreamWriter sw = File.AppendText(Properties.Settings.Default.PATH_EXECUTE + "\\Log.txt"))
                {
                    BcrServer_Helper.WriteLog.Instance.Write(ex.Message, "", sw);
                }
                uow.Rollback();
                return(AppCommon.ShowErrorMsg(777, " "));
            }
        }
Beispiel #2
0
        public int InsertToBoxNotInPallete(BoxNotExist box)
        {
            string query = "INSERT INTO td_box_not_in_pallete(box_no, item, lot_no, qty, pallete_no, entry_date, entry_time, destination) VALUES (@box_no, @item, @lot, @qty, @pallete, @date, @time, @destination); ";

            return(ExcuteNonQuery(query, new Dictionary <string, object> {
                { "box_no", box.BoxNo },
                { "item", box.Item },
                { "lot", box.LotNo },
                { "qty", box.Qty },
                { "pallete", box.PalleteNo },
                { "date", box.EntryDate },
                { "time", box.EntryTime },
                { "destination", box.Destination }
            }));
        }