public IHttpActionResult Post橡胶薄片(橡胶薄片 橡胶薄片)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.橡胶薄片.Add(橡胶薄片);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (橡胶薄片Exists(橡胶薄片.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = 橡胶薄片.Id }, 橡胶薄片));
        }
        public IHttpActionResult Put橡胶薄片(Guid id, 橡胶薄片 橡胶薄片)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != 橡胶薄片.Id)
            {
                return(BadRequest());
            }

            db.Entry(橡胶薄片).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!橡胶薄片Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult Get橡胶薄片(Guid id)
        {
            橡胶薄片 橡胶薄片 = db.橡胶薄片.Find(id);

            if (橡胶薄片 == null)
            {
                return(NotFound());
            }

            return(Ok(橡胶薄片));
        }
Exemplo n.º 4
0
        public IHttpActionResult GetRC(Guid id, Guid lb)
        {
            橡胶薄片 橡胶薄片 = db.橡胶薄片s.Single <橡胶薄片>(x => x.Id == id && x.除 == false);


            if (橡胶薄片 == null)
            {
                return(NotFound());
            }
            橡胶薄片.作业员  = lb;
            橡胶薄片.生产时间 = DateTime.Now;
            db.SubmitChanges();

            return(Ok(橡胶薄片));
        }
Exemplo n.º 5
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            Guid typeno = new Guid();

            if (!CheckInput(tbTypeNo, "请输入胶料批号", ref typeno))
            {
                return;
            }
            int counter = 0;

            if (!CheckInput(tbCounter, "请输入要生成标签数量", ref counter))
            {
                return;
            }
            float width = 0;

            if (!CheckInput(tbWidth, "请输入要生成胶片宽度", ref width))
            {
                return;
            }
            float thick = 0;

            if (!CheckInput(tbThick, "请输入要生成胶片厚度", ref thick))
            {
                return;
            }
            float num = 0;

            if (!CheckInput(tbNum, "请输入要生成胶片数量", ref num))
            {
                return;
            }
            float consume = 0;

            if (!CheckInput(tbNum, "请输入要生成胶片消耗数量", ref consume))
            {
                return;
            }
            List <橡胶薄片> all = new List <橡胶薄片>();

            using (TransactionScope scope = new TransactionScope())
            {
                for (int i = 0; i < counter; i++)
                {
                    橡胶薄片 temp = new 橡胶薄片();
                    temp.Id   = Guid.NewGuid();
                    temp.胶料批号 = typeno;
                    temp.厚度   = thick;
                    temp.宽度   = width;
                    temp.数量   = num;
                    temp.消耗重量 = consume;
                    temp.生产序号 = i;
                    temp.生产时间 = DateTime.Now;
                    temp.登记时间 = DateTime.Now;
                    temp.出库时间 = DateTime.Now;
                    ddc.橡胶薄片s.InsertOnSubmit(temp);
                    all.Add(temp);
                }

                //if(DialogResult.Yes == MessageBox.Show("是否已经用完本垛胶料?","询问", MessageBoxButtons.YesNo,MessageBoxIcon.Question))
                //{
                //    if (DialogResult.Yes == MessageBox.Show("以用完本垛胶料将?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                //}

                ddc.SubmitChanges();
                scope.Complete();
            }
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();
                foreach (var item in all)
                {
                    var t = ddc.橡胶薄片s.Single(x => x.Id == item.Id && x.除 == false);
                    var n = ddc.胶料入库s.Single(x => x.Id == item.胶料批号 && x.除 == false);
                    if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.RC, item.Id.ToString()), n.胶料牌号 + n.登记时间.ToShortDateString()))
                    {
                        MessageBox.Show("打印错误,请重新生成胶片代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            dgOutRubber_SelectionChanged(null, null);
        }