Beispiel #1
0
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            string planCode = PlanCode.SelectedItem.Value.ToString();
            string resourceStore = ResourceStore.Text;
            string itemCode = ItemCode.Text;
            int    resourceQTY = int.Parse(ResourceQTY.Text);
            string destinationStore = ""; int transQTY = 0;

            if (DestinationStore.SelectedIndex < 0)
            {
                ErrorLabel.Visible = true;
                ErrorLabel.Text    = "请选择一个目标库!";
                return;
            }
            destinationStore = DestinationStore.SelectedItem.Value.ToString();
            if (resourceStore.Equals(destinationStore) || resourceStore == destinationStore)
            {
                ErrorLabel.Visible = true;
                ErrorLabel.Text    = "目标库不能与源库相同!";
                return;
            }
            if (string.IsNullOrEmpty(TransQTY.Text))
            {
                ErrorLabel.Visible = true;
                ErrorLabel.Text    = "请输入一个移库数量!";
                return;
            }
            try
            {
                transQTY = int.Parse(TransQTY.Text);
            }
            catch (Exception ex)
            {
                ErrorLabel.Visible = true;
                ErrorLabel.Text    = "请输入正确的移库数量!";
                return;
            }
            if ((resourceQTY - transQTY) < 0)
            {
                ErrorLabel.Visible = true;
                ErrorLabel.Text    = "移库数量不能大于库存数量!";
                return;
            }
            string msg = LineSideStockFactory.TransToWMSStore(planCode, resourceStore, itemCode, destinationStore, transQTY);

            if (msg == "true")
            {
                Response.Write("<script>alert('移库完成!');self.location.href=self.location.href;</script>");
            }
            else
            {
                Response.Write("<script>alert('" + msg + "!');</script>");
                return;
            }
        }