schangxiang@126.com
2025-09-17 60dd1afc3e8f94aa1b23211b6738d35b47294382
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using iWareCommon.Common.Entity;
using iWareDataCore.BASE.Entity;
using iWareDataCore.BASE.Service;
using iWareWms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
 
 
namespace iWareWms.View.FM.Place
{
    public partial class PlaceDetail : PageBase
    {
        protected override void Save(out string msg)
        {
 
            PlaceService.GetInstance().Save(GetPlace(), out msg);
            WriteLog("库位删除" + msg, "库位管理");
        }
 
        protected override void Update(out string msg)
        {
 
 
            var role = GetPlace();
            role.Id = Convert.ToInt32(Request.QueryString["Id"]);
            PlaceService.GetInstance().Update(role, out msg);
            WriteLog("库位更新" + msg, "库位管理");
        }
 
 
        private PlaceEntity GetPlace()
        {
 
 
            return new PlaceEntity
            {
                Code = tbCode.Text.Trim(),
                TypeId = Convert.ToInt32(ddlTypeId.SelectedValue),
                Row = Convert.ToInt32(nbRow.Text),
                Col = Convert.ToInt32(nbCol.Text),
                Layer = Convert.ToInt32(nbLayer.Text),
                Length = Convert.ToDecimal(nbLength.Text),
                Width = Convert.ToDecimal(nbWidth.Text),
                Height = Convert.ToDecimal(nbHeight.Text),
                Posx = Convert.ToInt32(nbX.Text),
                Posy = Convert.ToInt32(nbY.Text),
                Posz = Convert.ToInt32(nbZ.Text),
                MaxWeight=Convert.ToDecimal(nbMaxWeight.Text),
                HeightLevel = Convert.ToInt32(nbHeightLevel.Text),
            };
        }
 
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
 
            if (!IsPostBack)
            {
                string msg;
 
                var types = PlaceTypeService.GetInstance().QueryByParam(new QueryParam(), out msg);
                types.ForEach(x => ddlTypeId.Items.Add(x.Name, x.Id.ToString()));
 
                if (!string.IsNullOrEmpty(Request.QueryString["IsEdit"]))
                {
                    var places = PlaceService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Id", Request.QueryString["Id"] } } }, out msg);
                    
                    if (!string.IsNullOrEmpty(msg))
                    {    
                        return;
                    }
 
 
                    tbCode.Text = places.Count > 0 ? places[0].Code : "";
                    ddlTypeId.SelectedValue=places.Count > 0 ? places[0].TypeId.ToString() : "";
                    nbRow.Text= places.Count > 0 ? places[0].Row.ToString() : "";
                    nbCol.Text= places.Count > 0 ? places[0].Col.ToString() : "";
                    nbLayer.Text= places.Count > 0 ? places[0].Layer.ToString() : "";
                    nbLength.Text= places.Count > 0 ? places[0].Length.ToString() : "";
                    nbWidth.Text= places.Count > 0 ? places[0].Width.ToString() : "";
                    nbHeight.Text= places.Count > 0 ? places[0].Height.ToString() : "";
                    nbX.Text= places.Count > 0 ? places[0].Posx.ToString() : "";
                    nbY.Text= places.Count > 0 ? places[0].Posy.ToString() : "";
                    nbZ.Text= places.Count > 0 ? places[0].Posz.ToString() : "";
                    nbMaxWeight.Text= places.Count > 0 ? places[0].MaxWeight.ToString() : "";
                    nbHeightLevel.Text= places.Count > 0 ? places[0].HeightLevel.ToString() : "";
 
                }
               
            }
        } 
    }
}