public async Task <IActionResult> Edit(string id, [Bind("ID,StartTime,EndTime,Notes")] CheckSheet checkSheet)
        {
            if (id != checkSheet.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(checkSheet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CheckSheetExists(checkSheet.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkSheet));
        }
        public async Task <CheckSheet> Update(CheckSheet data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            await using var transaction = await _context.Database
                                          .BeginTransactionAsync()
                                          .ConfigureAwait(false);

            try
            {
                _context.CheckSheets.Update(data);
                await _context.SaveChangesAsync().ConfigureAwait(false);

                await transaction.CommitAsync().ConfigureAwait(false);

                return(data);
            }
            catch (Exception e)
            {
                await transaction.RollbackAsync().ConfigureAwait(false);

                throw new Exception(e.Message);
            }
        }
        public async Task <IActionResult> Create([Bind("ID,StartTime,EndTime,Notes")] CheckSheet checkSheet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(checkSheet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkSheet));
        }
Beispiel #4
0
        // D:客户退货单 A:采购入库 F:采购退货 G:调拨单
        void IInOutBLL.CheckInOut(string sheet_no, string approve_man, DateTime update_time)
        {
            var db = new DB.DBByAutoClose(Appsetting.conn);

            DB.IDB d = db;
            try
            {
                //
                string sql = "select trans_no,approve_flag,update_time from ic_t_inout_store_master where sheet_no='" + sheet_no + "'";
                var    tb  = d.ExecuteToTable(sql, null);
                if (tb.Rows.Count == 0)
                {
                    throw new Exception("单据不存在[" + sheet_no + "]");
                }

                ic_t_inout_store_master master = d.ExecuteToModel <ic_t_inout_store_master>("select * from ic_t_inout_store_master where sheet_no='" + sheet_no + "'", null);

                CheckSheet check = new CheckSheet();
                switch (master.trans_no)
                {
                case "A":
                    check.CheckPISheet(sheet_no, approve_man, update_time);
                    break;

                case "D":
                    check.CheckRISheet(sheet_no, approve_man, update_time);
                    break;

                case "F":
                    check.CheckROSheet(sheet_no, approve_man, update_time);
                    break;

                case "G":
                    check.CheckIOSheet(sheet_no, approve_man, update_time);
                    break;

                case "I":
                    check.CheckSOSheet(sheet_no, approve_man, update_time);
                    break;

                default:
                    check.CheckOOSheet(sheet_no, approve_man, update_time);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogHelper.writeLog("InOutBLL.CheckInOut()", ex.ToString(), sheet_no, approve_man);
                throw ex;
            }
        }
 public async Task <CheckSheet> IsExist(CheckSheet data)
 {
     return(await _context.CheckSheets
            .AsNoTracking()
            .FirstOrDefaultAsync(
                x =>
                x.ControlMethodId == data.ControlMethodId &&
                x.LineId == data.LineId &&
                x.OrganizationPartId == data.OrganizationPartId &&
                x.ShiftDate == data.ShiftDate &&
                x.Shift == data.Shift
                )
            .ConfigureAwait(false));
 }
Beispiel #6
0
        public int AddCheckSheet(int checkSheetTypeId)
        {
            var checkSheet = new CheckSheet
            {
                CheckSheetTypeId = checkSheetTypeId,
                SignOffUserId    = null,
                StartDateUtc     = DateTime.Today,
                Comment          = "",
            };

            checkSheetRepo.Add(checkSheet);
            checkSheetRepo.SaveChanges();

            return(checkSheet.CheckSheetId);
        }
Beispiel #7
0
        public async Task <CheckSheet> Login(CheckSheetDto data)
        {
            var ds = _dateShift.GetCurrentDateShift("Machining");

            var body = new CheckSheet
            {
                ControlMethodId    = data.ControlMethodId,
                LineId             = data.LineId,
                OrganizationPartId = data.OrganizationPartId,
                ShiftDate          = ds.ShiftDate,
                Shift       = ds.Shift,
                ClockNumber = data.ClockNumber,
                HourId      = data.HourId,
                TimeStamp   = DateTime.Now
            };

            return(await IsExist(body) ?? await Create(body));
        }
Beispiel #8
0
        void IBLL.ICusFY.Check(string sheet_no, string approve_man)
        {
            CheckSheet check = new CheckSheet();

            check.CheckCustFYSheet(sheet_no, approve_man, DateTime.Now);
        }
Beispiel #9
0
        void IBLL.ISupSettle.Check(string sheet_no, string approve_man)
        {
            CheckSheet check = new CheckSheet();

            check.CheckSupJSSheet(sheet_no, approve_man, DateTime.Now);
        }
Beispiel #10
0
        void IBLL.ICashOrder.Check(string sheet_no, string approve_man)
        {
            CheckSheet check = new CheckSheet();

            check.CheckBankSheet(sheet_no, approve_man, DateTime.Now);
        }
Beispiel #11
0
        void IInOutBLL.CheckSaleSheet(string sheet_no, string approve_man, DateTime update_time)
        {
            CheckSheet check = new CheckSheet();

            check.CheckSOSheet(sheet_no, approve_man, update_time);
        }