310 lines
11 KiB
C#
310 lines
11 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using DevExpress.XtraEditors;
|
|||
|
|
using WMS.Base.WebService;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Drawing.Drawing2D;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmReport
|
|||
|
|
{
|
|||
|
|
public partial class FrmLayout : FormBase
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> listLoc = new List<StorageAreaLocationModel>();
|
|||
|
|
StorageAreaLocationModel loc = new StorageAreaLocationModel();
|
|||
|
|
int lastI = 0;
|
|||
|
|
int i = 0;
|
|||
|
|
int cw = 60;
|
|||
|
|
int ch = 30;
|
|||
|
|
int space = 5;
|
|||
|
|
|
|||
|
|
public FrmLayout()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void panelControl1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
PanelControl panel = sender as PanelControl;
|
|||
|
|
string loc = panel.Tag.ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void lueStorage_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (lueStorage.EditValue != null && !string.IsNullOrEmpty(lueStorage.EditValue.ToString()))
|
|||
|
|
{
|
|||
|
|
//绑定库区数据
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
StorageAreaModel storageAreaModel = new StorageAreaModel();
|
|||
|
|
storageAreaModel.STORAGE_ID = lueStorage.EditValue.ToString();
|
|||
|
|
|
|||
|
|
string strParameter = Newtonsoft.Json.JsonConvert.SerializeObject(storageAreaModel);
|
|||
|
|
|
|||
|
|
string strResult = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
strResult = WebLockConfig.Instance.StorageArea.GetAreaInfoDS(strParameter, ref errText);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//如果查询库区数据成功
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
lueArea.Properties.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strResult);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void FrmLayout_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
lueStorage.LoadData();
|
|||
|
|
lueArea.LoadData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void lueArea_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (lueArea.EditValue != null && !string.IsNullOrEmpty(lueArea.EditValue.ToString()))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
List<StorageAreaLocationModel> listStorageAreaLocationModel = new List<StorageAreaLocationModel>();
|
|||
|
|
StorageAreaLocationModel storageAreaLocationModel = new StorageAreaLocationModel();
|
|||
|
|
storageAreaLocationModel.STORAGE_AREA_ID = lueArea.EditValue.ToString();
|
|||
|
|
storageAreaLocationModel.STATUS = "0";
|
|||
|
|
string strParameter = Newtonsoft.Json.JsonConvert.SerializeObject(storageAreaLocationModel);
|
|||
|
|
string strResult = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
strResult = WebLockConfig.Instance.StorageAreaLocation.GetLocationInfoDS(strParameter, ref errText);//查询
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
listLoc = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StorageAreaLocationModel>>(strResult);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
i = 0;
|
|||
|
|
NextPage();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void NextPage()
|
|||
|
|
{
|
|||
|
|
if (i == 0)
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("FirstPage")) { frmButtonItem["FirstPage"].Enabled = false; }
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("FirstPage")) { frmButtonItem["FirstPage"].Enabled = true; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("NextPage")) { frmButtonItem["NextPage"].Enabled = false; }
|
|||
|
|
lastI = i;
|
|||
|
|
|
|||
|
|
int x = 5;// panelControl3.Location.X; //0;
|
|||
|
|
int y = 5;// panelControl3.Location.Y;// panelControl2.Height;
|
|||
|
|
int newX = x;
|
|||
|
|
int w = panelControl3.Width;// this.Width;
|
|||
|
|
int h = panelControl3.Height;// this.Height - panelControl2.Height;
|
|||
|
|
|
|||
|
|
Graphics g = panelControl3.CreateGraphics();
|
|||
|
|
Rectangle rect = new Rectangle(x, y, w, h);
|
|||
|
|
Color color = Color.FromArgb(207,221,238);
|
|||
|
|
LinearGradientBrush lBrush = new LinearGradientBrush(rect, color, color, LinearGradientMode.BackwardDiagonal);
|
|||
|
|
g.FillRectangle(lBrush, rect);
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (; i < listLoc.Count; i++)
|
|||
|
|
{
|
|||
|
|
Pen pn = new Pen(Color.LightGray);
|
|||
|
|
|
|||
|
|
//库位背景
|
|||
|
|
rect = new Rectangle(newX, y + ch / 2, cw, ch / 2);
|
|||
|
|
lBrush = new LinearGradientBrush(rect, Color.White, Color.White, LinearGradientMode.BackwardDiagonal);
|
|||
|
|
g.FillRectangle(lBrush, rect);
|
|||
|
|
|
|||
|
|
//库位
|
|||
|
|
String drawString = listLoc[i].LOCATION_ID;
|
|||
|
|
Font drawFont = new Font("宋体", 10);
|
|||
|
|
SolidBrush drawBrush = new SolidBrush(Color.Black);
|
|||
|
|
Point drawPoint = new Point(newX, y + ch / 2);
|
|||
|
|
g.DrawString(drawString, drawFont, drawBrush, drawPoint);
|
|||
|
|
|
|||
|
|
|
|||
|
|
int has = 0;
|
|||
|
|
if (listLoc[i].HASVOLUME != 0)
|
|||
|
|
{
|
|||
|
|
has = (int)(listLoc[i].HASVOLUME / listLoc[i].VOLUME * cw);
|
|||
|
|
}
|
|||
|
|
if (has > cw)
|
|||
|
|
{
|
|||
|
|
has = cw;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//已占用容积 红条
|
|||
|
|
rect = new Rectangle(newX, y, has, (ch) / 2);
|
|||
|
|
lBrush = new LinearGradientBrush(rect, Color.FromArgb(239, 176, 157), Color.FromArgb(239, 176, 157), LinearGradientMode.BackwardDiagonal);
|
|||
|
|
g.FillRectangle(lBrush, rect);
|
|||
|
|
|
|||
|
|
//已占用容积 文字
|
|||
|
|
//drawString = listLoc[i].HASVOLUME.ToString();
|
|||
|
|
//drawPoint = new Point(newX, y);
|
|||
|
|
//g.DrawString(drawString, drawFont, drawBrush, drawPoint);
|
|||
|
|
|
|||
|
|
//未占用容积 背景
|
|||
|
|
rect = new Rectangle(newX + has, y, cw - has, (ch) / 2);
|
|||
|
|
lBrush = new LinearGradientBrush(rect, Color.White, Color.White, LinearGradientMode.BackwardDiagonal);
|
|||
|
|
g.FillRectangle(lBrush, rect);
|
|||
|
|
|
|||
|
|
////未占用容积 文字
|
|||
|
|
//drawString = (listLoc[i].VOLUME - listLoc[i].HASVOLUME).ToString();
|
|||
|
|
//drawPoint = new Point(newX + has, y);
|
|||
|
|
//g.DrawString(drawString, drawFont, drawBrush, drawPoint);
|
|||
|
|
|
|||
|
|
////总容积 文字
|
|||
|
|
//drawString = listLoc[i].VOLUME.ToString();
|
|||
|
|
//drawPoint = new Point(newX, y);
|
|||
|
|
//g.DrawString(drawString, drawFont, drawBrush, drawPoint);
|
|||
|
|
|
|||
|
|
////黑框
|
|||
|
|
//g.DrawRectangle(pn, newX, y, cw, ch);
|
|||
|
|
//黑线
|
|||
|
|
//g.DrawLine(pn, newX, y + ch, newX + cw, y + ch);
|
|||
|
|
//g.DrawLine(pn, newX + cw, y, newX + cw, y + ch);
|
|||
|
|
g.DrawLine(pn, newX, y + ch / 2, newX + cw, y + ch / 2);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (newX + (cw + space) * 2 <= w)
|
|||
|
|
{
|
|||
|
|
newX += cw + space;
|
|||
|
|
}
|
|||
|
|
else if (y + (ch + space) * 2 > h)
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("NextPage")) { frmButtonItem["NextPage"].Enabled = true; }
|
|||
|
|
i++;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
newX = x;
|
|||
|
|
y += ch + space;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void panelControl3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(loc.LOCATION_ID)) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
FormBase formBase = OpenFrmTable("WMS.FrmReport", "FrmMIStockSearch");//创建窗体
|
|||
|
|
if (formBase != null)
|
|||
|
|
{
|
|||
|
|
FrmMIStockSearch frm = formBase as FrmMIStockSearch;
|
|||
|
|
frm.loc = loc;
|
|||
|
|
if (!OpenTabAddFrm("1701", "FrmMIStockSearch", "库存查看"))
|
|||
|
|
{
|
|||
|
|
frm.FrmMIStockSearch_Load(null, null);//如果已经被打开,执行一下窗体加载方法
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Refresh()
|
|||
|
|
{
|
|||
|
|
i = lastI;
|
|||
|
|
NextPage();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void FirstPage()
|
|||
|
|
{
|
|||
|
|
i = 0;
|
|||
|
|
NextPage();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void MouseMove(object sender, MouseEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
txtHad.Text = string.Empty;
|
|||
|
|
txtLeft.Text = string.Empty;
|
|||
|
|
|
|||
|
|
Point contextMenuPoint = panelControl3.PointToClient(Control.MousePosition);
|
|||
|
|
int mouseX = contextMenuPoint.X;
|
|||
|
|
int mouseY = contextMenuPoint.Y;
|
|||
|
|
|
|||
|
|
int x = 5;// panelControl3.Location.X; //0;
|
|||
|
|
int newX = x;
|
|||
|
|
int y = 5;// panelControl3.Location.Y;// panelControl2.Height;
|
|||
|
|
int w = panelControl3.Width;// this.Width;
|
|||
|
|
int h = panelControl3.Height;// this.Height - panelControl2.Height;
|
|||
|
|
|
|||
|
|
int temp = lastI;
|
|||
|
|
loc = new StorageAreaLocationModel();
|
|||
|
|
|
|||
|
|
for (; lastI < listLoc.Count; lastI++)
|
|||
|
|
{
|
|||
|
|
if (mouseX >= newX && mouseX <= newX + cw && mouseY >= y && mouseY <= y + ch) {
|
|||
|
|
|
|||
|
|
loc.STORAGE_ID = lueStorage.EditValue.ToString();
|
|||
|
|
loc.STORAGE_AREA_ID = lueArea.EditValue.ToString();
|
|||
|
|
loc.LOCATION_ID = listLoc[lastI].LOCATION_ID;
|
|||
|
|
loc.VOLUME = listLoc[lastI].VOLUME;
|
|||
|
|
loc.HASVOLUME = listLoc[lastI].HASVOLUME;
|
|||
|
|
|
|||
|
|
txtHad.Text = loc.HASVOLUME.ToString();
|
|||
|
|
txtLeft.Text = (loc.VOLUME - loc.HASVOLUME).ToString();
|
|||
|
|
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (newX + (cw + space) * 2 <= w)
|
|||
|
|
{
|
|||
|
|
newX += cw + space;
|
|||
|
|
}
|
|||
|
|
else if (y + (ch + space) * 2 > h)
|
|||
|
|
{
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
newX = x;
|
|||
|
|
y += ch + space;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
lastI = temp;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|