public async Task <int> EditPPT(PrProductTask table)
        {
            var task = await _IPrProductTaskService.FindAsyncById(table.Id);

            task.No           = table.No;
            task.ProductId    = table.ProductId;
            task.Nums         = table.Nums;
            task.ProductDate  = table.ProductDate;
            task.Batch        = table.Batch;
            task.DepartmentId = table.DepartmentId;
            task.Remark       = table.Remark;
            return(await _IPrProductTaskService.Edit(task));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <InfoResult <ProcductTaskDtos> > > ProductPutInStorage(PrProductTask productrecord)
        {
            var z       = Operator_id;
            int id      = int.Parse(_httpContext.HttpContext.User.FindFirst("operator_id").Value);
            var data    = (await _IAcUserinfoService.Search(t => t.Id == id)).FirstOrDefault();
            var data2   = (await _IAcStaffService.Search(t => t.Id == data.StaffId)).FirstOrDefault();
            var cusList = await _IIcProductRecordService.Search(t => true);

            int max = 0;

            foreach (var item in cusList)
            {
                if (item.Id > max)
                {
                    max = item.Id;
                }
            }
            int             Id = max + 1;
            IcProductRecord ic = new IcProductRecord()
            {
                Id             = Id,
                Name           = "入库",
                IsIn           = 0,
                SourceCategory = 0,
                SourceId       = productrecord.Id,
                SourceNo       = productrecord.No,
                ProductId      = productrecord.ProductId,
                Batch          = productrecord.Batch,
                Nums           = productrecord.Nums,
                Reason         = productrecord.Remark,
                DepartmentId   = productrecord.DepartmentId,
                StaffId        = productrecord.OperatorId,
                WarehouseId    = 1,
                OperatorId     = data2.Id,
                OperateTime    = productrecord.OperateTime,
                Status         = 1,
            };
            var data3 = await _IIcProductRecordService.Add(ic);

            productrecord.Status = 3;
            var data4 = await _IPrProductTaskService.Edit(productrecord);

            PrProduct product = (await _IPrProductService.Search(t => t.Id == productrecord.ProductId)).FirstOrDefault();

            product.Stock += productrecord.Nums;
            var data5 = await _IPrProductService.Edit(product);

            InfoResult <ProcductTaskDtos> messageModel = new InfoResult <ProcductTaskDtos>();

            if (data3 > 0 && data4 > 0)
            {
                messageModel.Msg     = "入库成功!";
                messageModel.Code    = 400;
                messageModel.Success = true;
            }
            else if (data3 > 0)
            {
                messageModel.Msg     = "入库失败!";
                messageModel.Code    = 201;
                messageModel.Success = false;
            }
            else
            {
                messageModel.Msg     = "添加失败!";
                messageModel.Code    = 201;
                messageModel.Success = false;
            }
            return(Ok(messageModel));
        }