Exemple #1
0
        public async Task UpdateWarehouseAsync(int id, WarehouseEntity warehouse)
        {
            warehouse.WarehouseId             = id;
            _dbContext.Entry(warehouse).State = EntityState.Modified;

            await _dbContext.SaveChangesAsync();
        }
 private void FillDataWarehouseToForm(WarehouseEntity warehouse)
 {
     txtAddress.Text       = warehouse.Location;
     txtInfo.Text          = warehouse.Description;
     txtName.Text          = warehouse.Name;
     txtWarehouseCode.Text = warehouse.IdCode;
 }
Exemple #3
0
        private void OnCreateChanage(object sender, EventArgs e)
        {
            WarehouseEntity newEntity = (WarehouseEntity)sender;

            bindingSource1.Add(newEntity);
            bindingSource1.ResetBindings(false);
        }
Exemple #4
0
        /// <summary>
        /// 添加或编辑仓库
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="operatorFlag">添加或编辑</param>
        /// <returns></returns>
        public int WarehouseAddAndUpdate(WarehouseEntity entity, bool isNew)
        {
            IMapper map = DatabaseInstance.Instance();
            int     ret = -2;

            if (isNew)
            {
                //检查编号是否已经存在
                if (IsWarehouseCodeExists(entity))
                {
                    return(-1);
                }
                ret = map.Execute("insert into WM_WAREHOUSE(WH_CODE, WH_NAME, ORG_CODE) " +
                                  "values(@COD, @NAM, @ORG_CODE)",
                                  new
                {
                    COD      = entity.WarehouseCode,
                    NAM      = entity.WarehouseName,
                    ORG_CODE = entity.OrgCode
                });
            }
            else
            {
                //更新
                ret = map.Execute("update WM_WAREHOUSE set WH_NAME = @NAM, ORG_CODE = @ORG_CODE where WH_CODE = @COD",
                                  new
                {
                    COD      = entity.WarehouseCode,
                    NAM      = entity.WarehouseName,
                    ORG_CODE = entity.OrgCode
                });
            }
            return(ret);
        }
 private void cbbWarehouse_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbbWarehouse.SelectedItem != null)
     {
         mWarehouse = (WarehouseEntity)cbbWarehouse.SelectedItem;
     }
 }
Exemple #6
0
        private bool Save()
        {
            if (!IsFieldValueValid())
            {
                return(false);
            }
            bool success = false;

            try
            {
                WarehouseEntity editEntity = PrepareSave();
                bool            ret        = WarehouseAddAndUpdate(editEntity, isNew);;
                //int ret = warehouseDal.WarehouseAddAndUpdate(editEntity, isNew);
                //if (ret == -1)
                //    MsgBox.Warn("仓库编号或名称已存在,请改为其他的仓库编号或名称。");
                //else if (ret == -2)
                //    MsgBox.Warn("更新失败,该行已经被其他人删除。");
                //else
                if (ret)
                {
                    success = true;
                    if (DataSourceChanged != null)
                    {
                        DataSourceChanged(editEntity, null);
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.Warn(ex.Message);
            }
            return(success);
        }
 public static void UpdateItem(WarehouseEntity item)
 {
     using (var db = new InventarioContext())
     {
         db.WarehouseEntities.Update(item);
         db.SaveChanges();
     }
 }
Exemple #8
0
 public static void UpdateWarehouse(WarehouseEntity objWarehouse)
 {
     using (var db = new InventaryContext())
     {
         db.Warehouses.Update(objWarehouse); //ubica el objeto por su Id y ejecuta los cambios que tenga en las demas propiedades.
         db.SaveChanges();                   //se confirman los cambios - agregar el nuevo elemento a la bd
     }
 }
Exemple #9
0
 public void DeleteWareHouse(WarehouseEntity oWareHouse)
 {
     using (var db = new InventoryContext())
     {
         db.Remove(oWareHouse);
         db.SaveChanges();
     }
 }
 public WarehouseModel ToModel(WarehouseEntity warehouse)
 {
     return new WarehouseModel
     {
         Distance = warehouse.RelativeDistance,
         Name = warehouse.CompanyName
     };
 }
Exemple #11
0
 public static void UpdateWarehouse(WarehouseEntity oWarehouse)
 {
     using (var db = new InventaryContext())
     {
         db.Warehouses.Update(oWarehouse);
         db.SaveChanges();
     }
 }
Exemple #12
0
 public void CreateWareHouse(WarehouseEntity oWareHouse)
 {
     using (var db = new InventoryContext())
     {
         db.Add(oWareHouse);
         db.SaveChanges();
     }
 }
Exemple #13
0
        /// <summary>
        /// 检查仓库编码是否已存在
        /// </summary>
        /// <param name="dept"></param>
        /// <returns></returns>
        private bool IsWarehouseCodeExists(WarehouseEntity Warehouse)
        {
            IMapper map = DatabaseInstance.Instance();
            string  id  = map.ExecuteScalar <string>("select WH_CODE from WM_WAREHOUSE where WH_CODE = @COD",
                                                     new { COD = Warehouse.WarehouseCode });

            return(!string.IsNullOrEmpty(id));
        }
Exemple #14
0
    public override bool checkProceduralPrecondition(GameObject agent)
    {
        Agent abstractAgent = (Agent)agent.GetComponent(typeof(Agent));

        targetWarehouse = abstractAgent.warehouse;
        target          = targetWarehouse.gameObject;
        return(targetWarehouse != null);
    }
Exemple #15
0
        // ----------> Create

        public static void CreateWarehouse(WarehouseEntity objWarehouse)
        {
            using (var db = new InventaryContext())
            {
                db.Warehouses.Add(objWarehouse);
                db.SaveChanges();
            }
        }
 private void lbListWarehouse_SelectedIndexChanged(object sender, EventArgs e)
 {
     warehouseCreateOrUpdate = (WarehouseEntity)lbListWarehouse.SelectedItem;
     if (warehouseCreateOrUpdate != null)
     {
         FillDataWarehouseToForm(warehouseCreateOrUpdate);
     }
 }
Exemple #17
0
 void Start()
 {
     buttonComponent.onClick.AddListener(HandleClick);
     WarehouseEntity[] warehouses = (WarehouseEntity[])FindObjectsOfType(typeof(WarehouseEntity));
     if (warehouses.Length > 0)
     {
         warehouse = warehouses[0];
     }
 }
 private void btnCreate_Click(object sender, EventArgs e)
 {
     warehouseCreateOrUpdate = null;
     txtAddress.Text         = "";
     txtName.Text            = "";
     txtInfo.Text            = "";
     txtWarehouseCode.Text   = "";
     txtName.Focus();
 }
Exemple #19
0
        public static Business_Response ValidateCreateWarehouse(WarehouseEntity oWarehouse)
        {
            using var db = new InventoryContext();
            var warehouses             = db.Warehouses.ToList();
            Business_Response response = new Business_Response();

            //Referencia
            do
            {
                oWarehouse.WarehouseId = Guid.NewGuid().ToString();//Asigna un identificador a la bodega hasta garantizar que sea único.
            } while (warehouses.Where(w => w.WarehouseId == oWarehouse.WarehouseId).Any());

            WarehouseEntity cWarehouse = (WarehouseEntity)oWarehouse.Clone();

            //Nombre de la bodega.

            if (cWarehouse.WarehouseName == null || cWarehouse.WarehouseName.Length < 2)
            {
                cWarehouse.WarehouseName = "";
                response.Error           = true;
                response.ErrorMessages.Add("El nombre de la bodega debe ser mayor a 1 caracter.");
            }

            if (cWarehouse.WarehouseName.Length > 100)
            {
                response.Error = true;
                response.ErrorMessages.Add("El nombre de la bodega debe ser menor a 100 caracteres.");
            }

            if (warehouses.Where(w => w.WarehouseName == cWarehouse.WarehouseName).Any())
            {
                response.Error = true;
                response.ErrorMessages.Add($"El nombre de la bodega {cWarehouse.WarehouseName} ya existe.");
            }

            //Dirección de la bodega.
            if (cWarehouse.WarehouseAddress == null || cWarehouse.WarehouseAddress.Length < 4)
            {
                cWarehouse.WarehouseAddress = "";
                response.Error = true;
                response.ErrorMessages.Add("La dirección de la bodega debe ser mayor a 4 caracteres.");
            }

            if (cWarehouse.WarehouseAddress.Length > 100)
            {
                response.Error = true;
                response.ErrorMessages.Add("La dirección de la bodega debe ser menor a 100 caracteres.");
            }

            if (warehouses.Where(w => w.WarehouseAddress == cWarehouse.WarehouseAddress).Any())
            {
                response.Error = true;
                response.ErrorMessages.Add($"La dirección de la bodega {cWarehouse.WarehouseAddress} ya está registrada.");
            }

            return(response);
        }
Exemple #20
0
    public override bool checkProceduralPrecondition(GameObject agent)
    {
        Agent abstractAgent = (Agent)agent.GetComponent(typeof(Agent));

        targetWarehouse = abstractAgent.warehouse;
        target          = targetWarehouse.gameObject;
        // Debug.DrawLine(target.transform.position, agent.transform.position, Color.yellow, 3, false);
        return(targetWarehouse != null);
    }
Exemple #21
0
 public static void CreateWarehouse(WarehouseEntity objWarehouse)
 {
     using (var db = new InventaryContext())
     {
         objWarehouse.WarehouseId = Guid.NewGuid().ToString();
         db.Warehouses.Add(objWarehouse); //se añade el nuevo objeto
         db.SaveChanges();                //se confirman los cambios - agregar el nuevo elemento a la bd
     }
 }
Exemple #22
0
        public async Task <TData <string> > SaveForm(WarehouseEntity entity)
        {
            TData <string> obj = new TData <string>();
            await warehouseService.SaveForm(entity);

            obj.Data = entity.Id.ParseToString();
            obj.Tag  = 1;
            return(obj);
        }
Exemple #23
0
        public RepAsnTransfer(int billID, short copies)
            : this()
        {
            BillID      = billID;
            this.copies = copies;

            //获取数据
            try
            {
                header = GetBillHeader(BillID);
                WarehouseEntity warehouseEntity = GetWarehouseByCode(header.Sales);
                if (warehouseEntity != null)
                {
                    this.lblFormWarehouse.Text = warehouseEntity.WarehouseName;
                }
                else
                {
                    this.lblFormWarehouse.Text = header.Sales;
                }
                this.xrLabel10.Text = GlobeSettings.LoginedUser.WarehouseName;
                List <PODetailEntity> details = GetDetailByBillID(BillID);

                dataSource         = new ASNBody();
                dataSource.Header  = header;
                dataSource.Details = details;
                decimal n = 0;
                foreach (PODetailEntity entity in this.dataSource.Details)
                {
                    decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.MaterialName.Length) / ConvertUtil.ToDecimal(12));
                    if (num > 2)
                    {
                        n += num;
                    }
                }
                // 更新打印次数
                if (header.Printed == 0)
                {
                    this.xrLabel7.Text = (header.Printed + 1).ToString();
                    UpdatePrinted(header.BillID, header.Printed);
                    header.Printed++;
                    UpdatePrinted(header.BillID, header.Printed);
                }
                else
                {
                    header.Printed++;
                    this.xrLabel7.Text = header.Printed.ToString();
                    UpdatePrinted(header.BillID, header.Printed);
                }

                this.PageHeight = (int)(details.Count + n) * 65 + 920;
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
        }
Exemple #24
0
        /// <summary>
        /// 收货单据管理,打印---查询仓库信息
        /// </summary>
        /// <param name="whCode"></param>
        /// <returns></returns>
        public WarehouseEntity GetWarehouseByCode(string whCode)
        {
            WarehouseEntity tm = new WarehouseEntity();

            try
            {
                #region 请求数据
                System.Text.StringBuilder loStr = new System.Text.StringBuilder();
                loStr.Append("whCode=").Append(whCode);
                string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetWarehouseByCode);
                if (string.IsNullOrEmpty(jsonQuery))
                {
                    MsgBox.Warn(WebWork.RESULT_NULL);
                    //LogHelper.InfoLog(WebWork.RESULT_NULL);
                    return(tm);
                }
                #endregion

                #region 正常错误处理

                JsonGetWarehouseByCode bill = JsonConvert.DeserializeObject <JsonGetWarehouseByCode>(jsonQuery);
                if (bill == null)
                {
                    MsgBox.Warn(WebWork.JSON_DATA_NULL);
                    return(tm);
                }
                if (bill.flag != 0)
                {
                    MsgBox.Warn(bill.error);
                    return(tm);
                }
                #endregion
                List <WarehouseEntity> list = new List <WarehouseEntity>();
                #region 赋值数据
                foreach (JsonGetWarehouseByCodeResult jbr in bill.result)
                {
                    WarehouseEntity asnEntity = new WarehouseEntity();
                    asnEntity.WarehouseCode = jbr.whCode;
                    asnEntity.WarehouseName = jbr.whName;
                    asnEntity.XCoor         = jbr.xCoor;
                    asnEntity.YCoor         = jbr.yCoor;
                    list.Add(asnEntity);
                }
                if (list.Count > 0)
                {
                    return(list[0]);
                }
                #endregion
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
            return(tm);
        }
Exemple #25
0
        ///<summary>
        ///查询所有仓库
        ///</summary>
        ///<returns></returns>
        public List <WarehouseEntity> GetAllWarehouse()
        {
            List <WarehouseEntity> list = new List <WarehouseEntity>();

            try
            {
                #region 请求数据
                System.Text.StringBuilder loStr = new System.Text.StringBuilder();
                //loStr.Append("vhNo=").Append(vehicleNO);
                string jsons     = string.Empty;
                string jsonQuery = WebWork.SendRequest(jsons, WebWork.URL_GetAllWarehouse);
                if (string.IsNullOrEmpty(jsonQuery))
                {
                    MsgBox.Warn(WebWork.RESULT_NULL);
                    //LogHelper.InfoLog(WebWork.RESULT_NULL);
                    return(list);
                }
                #endregion

                #region 正常错误处理

                JsonGetAllWarehouse bill = JsonConvert.DeserializeObject <JsonGetAllWarehouse>(jsonQuery);
                if (bill == null)
                {
                    MsgBox.Warn(WebWork.JSON_DATA_NULL);
                    return(list);
                }
                if (bill.flag != 0)
                {
                    MsgBox.Warn(bill.error);
                    return(list);
                }
                #endregion

                #region 赋值数据
                foreach (JsonGetAllWarehouseResult jbr in bill.result)
                {
                    WarehouseEntity asnEntity = new WarehouseEntity();
                    asnEntity.OrgCode       = jbr.orgCode;
                    asnEntity.OrgName       = jbr.orgName;
                    asnEntity.WarehouseCode = jbr.whCode;
                    asnEntity.WarehouseName = jbr.whName;
                    list.Add(asnEntity);
                }
                return(list);

                #endregion
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
            return(list);
        }
Exemple #26
0
 public ActionResult SubmitForm(WarehouseEntity entity, string keyValue)
 {
     try
     {
         warehouseApp.SubmitForm(entity, keyValue);
     }
     catch (Exception em)
     {
         return(Error("保存失败", em.Message));
     }
     return(Success("保存成功"));
 }
        public async Task <ActionResult> Put(int id, WarehouseEntity warehouse)
        {
            var exists = await repository.GetWarehouseByIdAsync(id);

            if (exists == null)
            {
                return(NotFound());
            }

            await repository.UpdateWarehouseAsync(id, warehouse);

            return(NoContent());
        }
Exemple #28
0
 /// <summary>
 /// 提交仓库信息
 /// </summary>
 /// <param name="entity"></param>
 public void SubmitForm(WarehouseEntity warehouseEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         warehouseEntity.Modify(keyValue);
         repository.Update(warehouseEntity);
     }
     else
     {
         warehouseEntity.Create();
         repository.Insert(warehouseEntity);
     }
 }
Exemple #29
0
        public static Business_Response ValidateUpdateWarehouse(WarehouseEntity oWarehouse)
        {
            using var db = new InventoryContext();
            var warehouses               = db.Warehouses.ToList();
            Business_Response response   = new Business_Response();
            WarehouseEntity   cWarehouse = (WarehouseEntity)oWarehouse.Clone();

            //Nombre de la bodega.

            if (cWarehouse.WarehouseName == null || cWarehouse.WarehouseName.Length < 2)
            {
                cWarehouse.WarehouseName = "";
                response.Error           = true;
                response.ErrorMessages.Add("El nombre de la bodega debe ser mayor a 1 caracter.");
            }

            if (cWarehouse.WarehouseName.Length > 100)
            {
                response.Error = true;
                response.ErrorMessages.Add("El nombre de la bodega debe ser menor a 100 caracteres.");
            }

            if (warehouses.Where(w => (w.WarehouseId != cWarehouse.WarehouseId) && (w.WarehouseName == cWarehouse.WarehouseName)).Any())
            {
                response.Error = true;
                response.ErrorMessages.Add($"El nombre de la bodega {cWarehouse.WarehouseName} ya existe.");
            }

            //Dirección de la bodega.
            if (cWarehouse.WarehouseAddress == null || cWarehouse.WarehouseAddress.Length < 4)
            {
                cWarehouse.WarehouseAddress = "";
                response.Error = true;
                response.ErrorMessages.Add("La dirección de la bodega debe ser mayor a 4 caracteres.");
            }

            if (cWarehouse.WarehouseAddress.Length > 100)
            {
                response.Error = true;
                response.ErrorMessages.Add("La dirección de la bodega debe ser menor a 100 caracteres.");
            }

            if (warehouses.Where(w => (w.WarehouseId != cWarehouse.WarehouseId) && (w.WarehouseAddress == cWarehouse.WarehouseAddress)).Any())
            {
                response.Error = true;
                response.ErrorMessages.Add($"La dirección de la bodega {cWarehouse.WarehouseAddress} ya está registrada.");
            }

            return(response);
        }
Exemple #30
0
 void Start()
 {
     // Found and save buildings references
     WarehouseEntity[] warehouses = (WarehouseEntity[])FindObjectsOfType(typeof(WarehouseEntity));
     if (warehouses.Length > 0)
     {
         warehouse = warehouses[0];
     }
     CenterEntity[] centers = (CenterEntity[])FindObjectsOfType(typeof(CenterEntity));
     if (centers.Length > 0)
     {
         center = centers[0];
     }
 }