Esempio n. 1
0
        public async Task <IActionResult> ADDBOM([FromForm] IFormCollection fm)
        {
            var BOM        = fm["BOM"].ToString();
            var PRICE      = fm["PRICE"].ToString();
            var CRT_USER   = fm["CRT_USER"].ToString();
            var MODEL      = fm["MODEL"].ToString();
            var CLIENTNAME = fm["CLIENTNAME"].ToString();
            var CLIENTCODE = fm["CLIENTCODE"].ToString();

            if (string.IsNullOrWhiteSpace(BOM))
            {
                return(NotFound());
            }
            else
            {
                BOM   = BOM.Trim();
                PRICE = PRICE.Trim();
            }
            if (string.IsNullOrEmpty(MODEL))
            {
                MODEL = MODEL.Trim();
            }
            var getbom = await _sqlRepository.GetDA_BOM(BOM);

            if (getbom == null)
            {
                var dA_BOM = new DA_BOM
                {
                    BOM        = BOM,
                    Id         = new Guid(),
                    PRICE      = PRICE,
                    CRT_USER   = CRT_USER,
                    MODEL      = MODEL,
                    CLIENTCODE = CLIENTCODE,
                    CLIENTNAME = CLIENTNAME
                };
                _sqlRepository.AddDA_BOM(dA_BOM);
                await _sqlRepository.SaveAsync();

                return(Ok(BOM + "保存完成!!"));
            }
            else
            {
                getbom.PRICE      = PRICE;
                getbom.CRT_DATE   = System.DateTime.Now;
                getbom.PRICE      = PRICE;
                getbom.CRT_USER   = CRT_USER;
                getbom.MODEL      = MODEL;
                getbom.CLIENTCODE = CLIENTCODE;
                getbom.CLIENTNAME = CLIENTNAME;
                _sqlRepository.UpdateDA_BOM(getbom);
                await _sqlRepository.SaveAsync();

                return(Ok(BOM + "更新完成!!"));
            }
            //return Ok();
        }
Esempio n. 2
0
        public async Task <IActionResult> DE_PRICE(string Guids)
        {
            DA_BOM dA_ = await _sqlRepository.GetPrice(Guids);

            if (dA_ != null)
            {
                _sqlRepository.DeletePrice(dA_);
                await _sqlRepository.SaveAsync();
            }
            return(Ok());
        }