Ejemplo n.º 1
0
        protected bool checkpicked_qty(int ship_key, int num1)
        {
            ModelShip model = ship_dc.getshipbykey(ship_key);
            int       temp  = model.Request_qty - model.Picked_qty;

            if (temp >= num1)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成下一个出货单号
        /// </summary>
        /// <returns></returns>
        protected string nextShip_no()
        {
            ShipDC   ship_dc     = new ShipDC();
            string   lastship_no = "";
            string   head        = "P";
            string   end         = "0001";
            DateTime date        = DateTime.Now;
            //获取当前的时间
            string time = date.ToString("yyyyMMdd");
            //获取最后一次的ship_no
            ModelShip modelship = ship_dc.getLastShip_no();
            int       last_id   = ship_dc.getLast_id();//数据库中最后一次存储的ID
            int       ship_key;

            if (modelship == null)
            {
                return(null);
            }
            else
            {
                ship_key    = modelship.Ship_key;
                lastship_no = modelship.Ship_no;
            }
            if (lastship_no == null)
            {
                end = ((last_id + 1) % 10000).ToString("D4");// "0001";
            }
            else
            {
                int    s         = lastship_no.Length;
                string last_date = lastship_no.Substring(1, 8);//上一条数据的日期
                if (string.Compare(last_date, time, StringComparison.Ordinal) < 0)
                {
                    end = "0001";
                }
                else
                {
                    string last_no = lastship_no.Substring(s - 4, 4);
                    //获取后后四位,转换为数字
                    int last = int.Parse(last_no);
                    //格式化整型,D:十进制,4:字符串长度
                    end = (last_id - ship_key + last + 1).ToString("D4");
                    if (end.Equals("10000"))
                    {
                        end = "0001";
                    }
                }
            }
            return(head + time + end);
        }
Ejemplo n.º 3
0
        private ModelShip toModel(DataRow dr)
        {
            ModelShip model = new ModelShip();

            foreach (PropertyInfo propertyInfo in typeof(ModelShip).GetProperties())
            {
                if (dr[propertyInfo.Name].ToString() == "")
                {
                    continue;
                }
                model.GetType().GetProperty(propertyInfo.Name).SetValue(model, dr[propertyInfo.Name], null);
            }

            return(model);
        }
Ejemplo n.º 4
0
        public ModelShip getshipbykey(int ship_key)
        {
            string sql = "select * from wms_ship where ship_key = @ship_key ";

            SqlParameter[] parameters =
            {
                new SqlParameter("ship_key", ship_key)
            };

            DB.connect();
            DataSet   ds    = DB.select(sql, parameters);
            ModelShip model = null;

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    model = toModel(dr);
                }
            }
            return(model);
        }