123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using DbCommon.Enties.DbModels;
- using DbCommon.BusinessCore.BaseCore;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using ProjectManagementSystem.Common.Config;
- using ProjectManagementSystem.Common.Service;
- namespace ProjectManagementSystem.Forms
- {
- public partial class FormSetting : Form
- {
- public LocationProperty LocationProperty { get; set; }
- public FormSetting()
- {
- InitializeComponent();
- }
- public virtual void Init()
- {
- MaterialDetailManager materialDetailManager = new MaterialDetailManager();
- var materialList = materialDetailManager.GetList()
- .Select(d => d.MaterialId)
- .Distinct()
- .ToList();
- if(!string.IsNullOrEmpty(LocationProperty.MaterialId))
- {
- materialList.Add(LocationProperty.MaterialId);
- }
- materialList = materialList.Distinct().ToList();
- materialList.Add(string.Empty);
- cmbMaterial.DataSource = materialList;
- cmbMaterial.SelectedIndex = cmbMaterial.Items.Count - 1;
- }
- public virtual void UpdateDisplay()
- {
- if (LocationProperty == null) return;
- this.labArea.Text = LocationProperty.Area;
- this.labWareHouse.Text = LocationProperty.WareHouseCode;
- this.labLocation.Text = LocationProperty.LocationCode;
- if (string.IsNullOrEmpty(LocationProperty.MaterialId)) return;
- this.cmbMaterial.SelectedItem = LocationProperty.MaterialId;
- }
- private void FormSetting_Shown(object sender, EventArgs e)
- {
- }
- protected virtual void button1_Click(object sender, EventArgs e)
- {
- LocationStatus status = LocationProperty.Status;
- if(status == LocationStatus.Locked)
- {
- if(PmsTaskService.Instance.LocationHasTask(LocationProperty.LocationCode))
- {
- string msg = string.Format("状态为锁定,不能修改(需要强制修改请使用WMS)");
- MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- }
-
- string material = this.cmbMaterial.Text;
- if(!string.IsNullOrEmpty(material))
- {
- status = LocationStatus.Filled;
- }
- var m_locationManager = new LocationPropertyManager();
- var data = m_locationManager.GetById(LocationProperty.LocationCode);
- data.Status = status;
- data.MaterialId = material;
- var result = m_locationManager.Update(data);
- if (result)
- {
- MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.Close();
- }
- else
- {
- MessageBox.Show("保存失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- }
|