WMS系统后端开发-货位管理

1、区域API StorageAreas

 库区一般是指仓库下根据不同的功能区分的,如临时入库区,零拣区,大货区,临时出库区,中转区等等。而区域可以理解为地理上面的划分,在库区下再划分区域,主要是用于分工或者分组。比如将大货区分为A/B/C,某人拣货的区域只有A,或者是根据商品将某个供应商的货都放在A区,要看实际的仓库应用场景。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WMS_WebAPI.Models.Context;

namespace WMS_WebAPI.Controllers
{
    [Authorize]
    [RoutePrefix("api/StorageAreaMaster")]
    public class StorageAreaMasterController : ApiController
    {
        private WMS_Entities _context;

        StorageAreaMasterController()
        {
            _context = new WMS_Entities();
        }

        [HttpGet]
        [Route("")]
        public IHttpActionResult GetWarehouse(int WarehouseID)
        {
            var data = _context.GetStorageArea_byWarehouse(WarehouseID).ToList();
            if (data == null)
            {
                return NotFound();
            }

            return Ok(data);
        }

        //--------------
    }
}

2、区域API Storage

using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.Http;
using WMS_WebAPI.Models;
using WMS_WebAPI.Models.Context;
namespace WMS_WebAPI.Controllers
{
    public class StorageController : ApiController
    {
        WMS_Entities _context = new WMS_Entities();
        CommanListToDataTableConverter ConvertDataTable = new CommanListToDataTableConverter();
        string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString;
        [HttpPost]
        [Route("api/Storage/StorageAreas_Insert")]
        public IHttpActionResult StorageAreas_Insert(cls_Storage obj)
        {

            DataTable dtLTD_StorageAreaS = new DataTable();
            dtLTD_StorageAreaS = ConvertDataTable.ConvertToDataTable(obj.LTD_StorageAreaS);
            
            DataSet ds = new DataSet();
            try
            {
                using (SqlConnection connection = new SqlConnection(connectionstring))
                {
                    using (SqlCommand command = new SqlCommand("StorageAreas_Insert", connection))
                    {

                        command.CommandType = System.Data.CommandType.StoredProcedure;
                        SqlParameter[] param = new SqlParameter[4];
                        param[0] = new SqlParameter("@StorageAreaID", Convert.ToInt32(obj.StorageAreaID));

                        param[1] = new SqlParameter("@Storage", dtLTD_StorageAreaS);


                        param[2] = new SqlParameter("@createdBy", Convert.ToInt32(obj.createdBy));
                        param[3] = new SqlParameter("@BlockID", Convert.ToInt32(obj.BlockID));
                        

                        param[1].SqlDbType = SqlDbType.Structured;
                        

                        command.Parameters.AddRange(param);
                        connection.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(command))
                        {
                            da.Fill(ds);
                        }
                        connection.Close();
                    }
                    return Ok(ds);
                }
            }
            catch (System.Exception ex)
            {
                return BadRequest(ex.Message);
            }

        }


        [HttpPost]
        [Route("api/Storage/StorageArea_Select")]
        public IHttpActionResult StorageArea_Select(cls_Storage obj)
        {
            try
            {
                var data = _context.StorageArea_Select(obj.warehouseID).ToList();
                if (data == null)
                {
                    return NotFound();
                }
                return Ok(data);
            }
            catch (System.Exception)
            {

                return BadRequest();
            }

        }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

!chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值