1386 lines
58 KiB
C#
1386 lines
58 KiB
C#
|
|
using DevExpress.CodeParser;
|
|||
|
|
using DevExpress.Data.Db;
|
|||
|
|
using DevExpress.Emf;
|
|||
|
|
using DevExpress.XtraReports.Data;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using Oracle.ManagedDataAccess.Client;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Text.RegularExpressions;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Base;
|
|||
|
|
using WMS.Business.CK;
|
|||
|
|
using WMS.Business.Report;
|
|||
|
|
using WMS.Business.Stock;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.DBUtility;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
using WMS.IData;
|
|||
|
|
using WMS.Model.CK;
|
|||
|
|
using WMS.Model.Stock;
|
|||
|
|
using Label = System.Windows.Forms.Label;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmCK
|
|||
|
|
{
|
|||
|
|
public partial class FrmSdOrders : FormBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存List
|
|||
|
|
/// </summary>
|
|||
|
|
List<MIStockModel> miStockList = new List<MIStockModel>();
|
|||
|
|
|
|||
|
|
public FrmSdOrders()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
string barcode = string.Empty;
|
|||
|
|
string storid = string.Empty;
|
|||
|
|
string mesIP = string.Empty;
|
|||
|
|
private void FrmSdOrders_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在查询数据请等待...");
|
|||
|
|
|
|||
|
|
//mesIP = "10.10.90.192:8080";
|
|||
|
|
comboBox1.SelectedIndex = 0;
|
|||
|
|
comboBox2.SelectedIndex = 0;
|
|||
|
|
BindMiStockData();
|
|||
|
|
|
|||
|
|
loadForm.Dispose();
|
|||
|
|
loadForm.Close();
|
|||
|
|
}
|
|||
|
|
public override void Del()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
ctrlButtons3_Click(null, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定库存数据
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="mistock"></param>
|
|||
|
|
public void BindMiStockData()
|
|||
|
|
{
|
|||
|
|
DataTable list = IBussFactory<BussMIStockSearch>.Instance().GetMiStockForLookUp2();
|
|||
|
|
GCMiStock.DataSource = list;
|
|||
|
|
getList();
|
|||
|
|
|
|||
|
|
//new Thread(delegate ()
|
|||
|
|
//{
|
|||
|
|
// string errText = string.Empty;
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// this.Invoke(new MethodInvoker(delegate
|
|||
|
|
// {
|
|||
|
|
// //miStockList = IBussFactory<BussMIStockSearch>.Instance().GetMiStockForLookUp();
|
|||
|
|
|
|||
|
|
// //if (miStockList != null)
|
|||
|
|
// //{
|
|||
|
|
// // bgsStock.DataSource = miStockList;
|
|||
|
|
// //}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// // bgsStock.DataSource = list;// IBussFactory<BussMIStockSearch>.Instance().GetMiStockForLookUp2();
|
|||
|
|
// getList();
|
|||
|
|
|
|||
|
|
// }));
|
|||
|
|
// }
|
|||
|
|
// catch (Exception)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("error");
|
|||
|
|
// }
|
|||
|
|
//}).Start();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<OrderDetailModel> or_det_List = new List<OrderDetailModel>();
|
|||
|
|
private void GVMiStock_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVMiStock.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.txtCTL.Text = GVMiStock.GetFocusedRowCellValue("CTL").ToString();
|
|||
|
|
this.txtLocation.Text = GVMiStock.GetFocusedRowCellValue("LOCATION_ID").ToString();
|
|||
|
|
this.txtGoodsId.Text = GVMiStock.GetFocusedRowCellValue("GOODS_ID").ToString();
|
|||
|
|
//txtGoodsName.Text = GVMiStock.GetFocusedRowCellValue("GOODS_NAME").ToString();
|
|||
|
|
txtCCNum.Text = GVMiStock.GetFocusedRowCellValue("SHELVES_NUM").ToString();
|
|||
|
|
txtCKnum.Text = GVMiStock.GetFocusedRowCellValue("SHELVES_NUM").ToString();
|
|||
|
|
this.txtGDH.Text = GVMiStock.GetFocusedRowCellValue("PROVIDER_ID").ToString();
|
|||
|
|
t_sts.Text = GVMiStock.GetFocusedRowCellValue("STS").ToString();
|
|||
|
|
barcode = GVMiStock.GetFocusedRowCellValue("BARCODE").ToString();
|
|||
|
|
|
|||
|
|
//this.textBox2.Text = this.txtCTL.Text;
|
|||
|
|
storid = GVMiStock.GetFocusedRowCellValue("STORAGE_ID").ToString();
|
|||
|
|
if (t_sts.Text == "1")
|
|||
|
|
{
|
|||
|
|
t_sts.Text = "占用";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
t_sts.Text = "正常";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void getList()
|
|||
|
|
{
|
|||
|
|
List<PickingWaveGoodsModel> taskData = IBussFactory<BussPickingWaveGoods>.Instance().GetTaskdataHand();
|
|||
|
|
if (taskData != null)
|
|||
|
|
{
|
|||
|
|
bindingSource1.DataSource = taskData;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void Clear()
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.textBox1.Text.ToString() + "手动出库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string tasktype = string.Empty;
|
|||
|
|
if (textBox1.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("输入库位不能为空");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (textBox1.Text.Length != 11)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("输入库位格式不对");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (this.comboBox1.Text.Trim() == "A1" || this.comboBox1.Text.Trim() == "A4")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("不能出零拣");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
tasktype = "3";
|
|||
|
|
DataTable dt = IBussFactory<BussPickingWaveGoods>.Instance().getDecid(this.comboBox1.Text.Trim());
|
|||
|
|
string decidsts = dt.Rows[0]["STS"].ToString().Trim();
|
|||
|
|
if (decidsts != "2")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该库口非出库模式!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
IBussFactory<BussOrders>.Instance().InsTMISTOCK(textBox1.Text);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string orderstr = "SJD" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.PUTIN_ID = orderstr;
|
|||
|
|
or_Model.PICKINGID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = "111111";
|
|||
|
|
or_Model.LOC_ID = this.textBox1.Text;
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = 1;
|
|||
|
|
or_Model.BARCODE = "111111";
|
|||
|
|
or_Model.CTL = "111111";
|
|||
|
|
or_Model.status = "1";
|
|||
|
|
or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = tasktype;
|
|||
|
|
or_Model.PROVIDER_ID = "111111";
|
|||
|
|
or_Model.STORAGE_ID = "JXJW";
|
|||
|
|
or_Model.GOODS_NUM_SJ = 1;
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
|
|||
|
|
IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 工单ID:" + or_Model.PROVIDER_ID);
|
|||
|
|
}
|
|||
|
|
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public (string password, string number) GetPasswordAndNumber()
|
|||
|
|
{
|
|||
|
|
string sql = "select * from T_CK_NUMBER";
|
|||
|
|
DataSet result = OracleHelper.ExecuteDataset(CommandType.Text, sql);
|
|||
|
|
string password = result.Tables[0].Rows[0]["PASSWORD"].ToString();
|
|||
|
|
string number = result.Tables[0].Rows[0]["NUM"].ToString();
|
|||
|
|
|
|||
|
|
return (password, number);
|
|||
|
|
}
|
|||
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
int[] rownumber = GVMiStock.GetSelectedRows();
|
|||
|
|
//查询有没有输入数量和编号出库
|
|||
|
|
string GOODSID = textBox5.Text;string num = textBox4.Text;
|
|||
|
|
if (string.IsNullOrEmpty(GOODSID) ^ string.IsNullOrEmpty(num))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请补全物料或者数量出库,也可以清除数据手动选择物料出库");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (!string.IsNullOrEmpty(GOODSID) && !string.IsNullOrEmpty(num)&& rownumber.Length==0)
|
|||
|
|
{
|
|||
|
|
//都不为空则且未选中下方数据的是自动出库
|
|||
|
|
if (!System.Text.RegularExpressions.Regex.IsMatch(num, @"^[1-9]\d*$"))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("出库数量必须是有效的正整数(不能有前导零)");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
// 根据物料号和数量显示出符合条件的库存并且选中
|
|||
|
|
int requiredQuantity = int.Parse(num);
|
|||
|
|
decimal totalSelected = 0;
|
|||
|
|
|
|||
|
|
// 查询符合条件的库存,按生产日期升序排列(先进先出)
|
|||
|
|
string query = @"SELECT * FROM T_MI_STOCK
|
|||
|
|
WHERE GOODS_ID = :goodsId
|
|||
|
|
AND STS = '0' -- 只选择正常库存
|
|||
|
|
ORDER BY GOODS_SKU ASC,ORDER BY Shelves_Num ASC";
|
|||
|
|
|
|||
|
|
var parameters = new OracleParameter[] {
|
|||
|
|
new OracleParameter("goodsId", OracleDbType.Varchar2) { Value = GOODSID }
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
DataTable stockData = SystemDataObject.Instance.GetDataTable(query, parameters);
|
|||
|
|
|
|||
|
|
// 创建新的DataTable只包含符合条件的行
|
|||
|
|
DataTable filteredTable = stockData.Clone();
|
|||
|
|
|
|||
|
|
// 遍历结果,选择足够数量的记录
|
|||
|
|
foreach (DataRow row in stockData.Rows)
|
|||
|
|
{
|
|||
|
|
decimal availableQty = Convert.ToDecimal(row["SHELVES_NUM"]);
|
|||
|
|
|
|||
|
|
if (totalSelected < requiredQuantity)
|
|||
|
|
{
|
|||
|
|
// 计算还需要多少数量
|
|||
|
|
decimal needed = requiredQuantity - totalSelected;
|
|||
|
|
decimal toTake = (availableQty >= needed) ? needed : availableQty;
|
|||
|
|
|
|||
|
|
// 将符合条件的行添加到新表中
|
|||
|
|
filteredTable.ImportRow(row);
|
|||
|
|
|
|||
|
|
totalSelected += toTake;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
break; // 已经满足数量要求
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (totalSelected < requiredQuantity)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox($"库存不足,只有 {totalSelected} 可用,需要 {requiredQuantity}");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 重新绑定只包含选中行的数据
|
|||
|
|
GCMiStock.DataSource = filteredTable;
|
|||
|
|
|
|||
|
|
// 选中所有行(因为filteredTable只包含符合条件的行)
|
|||
|
|
GVMiStock.ClearSelection();
|
|||
|
|
for (int i = 0; i < GVMiStock.RowCount; i++)
|
|||
|
|
{
|
|||
|
|
GVMiStock.SelectRow(i);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 显示成功消息
|
|||
|
|
SystemCommon.ShowInfoMessageBox($"已自动筛选 {filteredTable.Rows.Count} 条库存记录,满足出库数量 {requiredQuantity}");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("请检查操作是否规范");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择物料出库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
//DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在生成出库任务请等待...");
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region
|
|||
|
|
//if (this.textBox2.Text == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("请选择物料信息");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
////if (txtLocation.Text.Substring(0,2) != "JW")
|
|||
|
|
////{
|
|||
|
|
//// SystemCommon.ShowInfoMessageBox("非立库库位");
|
|||
|
|
//// return;
|
|||
|
|
////}
|
|||
|
|
//if (t_sts.Text.Trim()=="占用")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("不能出库,库存已经被占用");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (this.txtCKnum.Text == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("请输入出库数");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
//if (Convert.ToDecimal(this.txtCKnum.Text.Trim()) > Convert.ToDecimal(this.txtCCNum.Text.Trim()))
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("出库数不能大于库存数");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
////if (this.txtGoodsId.Text.Trim()=="00000")
|
|||
|
|
////{
|
|||
|
|
//// SystemCommon.ShowInfoMessageBox("不能手动出空托盘");
|
|||
|
|
//// return;
|
|||
|
|
////}
|
|||
|
|
////if (this.comboBox1.Text.Trim() == "A1" || this.comboBox1.Text.Trim() == "A4")
|
|||
|
|
////{
|
|||
|
|
//// if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.txtLocation.Text.ToString() + "零拣出库吗?") == DialogResult.OK)
|
|||
|
|
//// {
|
|||
|
|
//// if (storid == "JXJWTH")
|
|||
|
|
//// {
|
|||
|
|
//// SystemCommon.ShowInfoMessageBox("退货存储不能生成零拣任务!");
|
|||
|
|
//// return;
|
|||
|
|
//// }
|
|||
|
|
//// if (ZjcheckB.Checked == true)
|
|||
|
|
//// {
|
|||
|
|
//// tasktype = "8";
|
|||
|
|
//// }
|
|||
|
|
//// else
|
|||
|
|
//// {
|
|||
|
|
//// tasktype = "7";
|
|||
|
|
//// }
|
|||
|
|
//// }
|
|||
|
|
//// else
|
|||
|
|
//// {
|
|||
|
|
//// comboBox1.Text = "A2";
|
|||
|
|
//// return;
|
|||
|
|
//// }
|
|||
|
|
////}
|
|||
|
|
////else
|
|||
|
|
////{
|
|||
|
|
//// tasktype = "3";
|
|||
|
|
//// DataTable dt = IBussFactory<BussPickingWaveGoods>.Instance().getDecid(this.comboBox1.Text.Trim());
|
|||
|
|
//// string decidsts = dt.Rows[0]["STS"].ToString().Trim();
|
|||
|
|
//// if (decidsts != "2")
|
|||
|
|
//// {
|
|||
|
|
//// SystemCommon.ShowInfoMessageBox("该库口非出库模式!");
|
|||
|
|
//// return;
|
|||
|
|
//// }
|
|||
|
|
////}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
//if (IBussFactory<BussPickingWaveGoods>.Instance().getPickData(this.txtLocation.Text))
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("该托盘已生成出库单!");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
var (password, number) = GetPasswordAndNumber();//获取两个值
|
|||
|
|
if (number == ""||number==null)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请输入限制任务数量");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int TASK_NUM = int.Parse(number);
|
|||
|
|
//判断已下发和待下发的出库的箱子是否大于等于number
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickDataCount(TASK_NUM))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox($"出库任务不能大于{TASK_NUM}条!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//判断周期
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (rownumber.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择出库物料");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string PORT = "0";
|
|||
|
|
if (this.comboBox2.Text == "请选择装箱口")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择装箱口");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (this.comboBox2.Text == "平均分")
|
|||
|
|
{
|
|||
|
|
PORT = "0";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
PORT = this.comboBox2.Text;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var selectedRows = rownumber
|
|||
|
|
.Select(rowHandle => GVMiStock.GetDataRow(rowHandle))
|
|||
|
|
.Where(row => row != null)
|
|||
|
|
.ToList();
|
|||
|
|
|
|||
|
|
// 找出周期最短的行(GOODS_SKU最小)
|
|||
|
|
DataRow earliestRow = selectedRows
|
|||
|
|
.OrderBy(row => row["GOODS_SKU"].ToString())
|
|||
|
|
.FirstOrDefault();
|
|||
|
|
|
|||
|
|
if (earliestRow == null)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未找到有效的库存数据");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 从周期最短的行中获取物料编号和周期
|
|||
|
|
string goodid = earliestRow["GOODS_ID"].ToString().Trim();
|
|||
|
|
string productiondate = earliestRow["GOODS_SKU"].ToString();
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickDataProductionDate(goodid, productiondate))
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("该物料还存在更早生产日期的可出库!");
|
|||
|
|
DialogResult result = MessageBox.Show("该物料还存在更早周期的可出库,确认出库吗?", "确认", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
|||
|
|
|
|||
|
|
if (result == DialogResult.Yes)
|
|||
|
|
{
|
|||
|
|
using (Form inputForm = new Form())
|
|||
|
|
{
|
|||
|
|
inputForm.Text = "出库确认";
|
|||
|
|
inputForm.Width = 300;
|
|||
|
|
inputForm.Height = 200;
|
|||
|
|
inputForm.FormBorderStyle = FormBorderStyle.FixedDialog;
|
|||
|
|
inputForm.StartPosition = FormStartPosition.CenterParent;
|
|||
|
|
|
|||
|
|
Label lblOperator = new Label() { Text = "操作人:", Top = 20, Left = 20, Width = 60 };
|
|||
|
|
TextBox txtOperator = new TextBox() { Top = 20, Left = 90, Width = 150 };
|
|||
|
|
|
|||
|
|
Label lblReason = new Label() { Text = "操作原因:", Top = 60, Left = 20, Width = 60 };
|
|||
|
|
TextBox txtReason = new TextBox() { Top = 60, Left = 90, Width = 150 };
|
|||
|
|
|
|||
|
|
Button btnOK = new Button() { Text = "确定", Top = 100, Left = 90, Width = 60 };
|
|||
|
|
|
|||
|
|
btnOK.DialogResult = DialogResult.OK;
|
|||
|
|
inputForm.AcceptButton = btnOK;
|
|||
|
|
|
|||
|
|
inputForm.Controls.Add(lblOperator);
|
|||
|
|
inputForm.Controls.Add(txtOperator);
|
|||
|
|
inputForm.Controls.Add(lblReason);
|
|||
|
|
inputForm.Controls.Add(txtReason);
|
|||
|
|
inputForm.Controls.Add(btnOK);
|
|||
|
|
|
|||
|
|
if (inputForm.ShowDialog() == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
string operatorName = txtOperator.Text.Trim();
|
|||
|
|
string reason = txtReason.Text.Trim();
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(operatorName) || string.IsNullOrEmpty(reason))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作人和操作原因不能为空!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SystemCommon.ShowInfoMessageBox("确定出库!");
|
|||
|
|
|
|||
|
|
// Log the operation
|
|||
|
|
string logMessage = $"{DateTime.Now.ToString()} 手动出库操作 - 操作人: {operatorName}, 原因: {reason}, " +
|
|||
|
|
$"物料编号: {goodid}, 周期: {productiondate}";
|
|||
|
|
LogWriteText.WriteLog(logMessage);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("取消出库!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (result == DialogResult.No)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("取消出库!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("取消出库!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (int i = 0; i < rownumber.Length; i++)
|
|||
|
|
{
|
|||
|
|
string BARCODE = GVMiStock.GetRowCellValue(rownumber[i], "BARCODE").ToString();
|
|||
|
|
string CTL = GVMiStock.GetRowCellValue(rownumber[i], "CTL").ToString();
|
|||
|
|
string tasktype = string.Empty;
|
|||
|
|
DataSet dt = IBussFactory<BussMIStock>.Instance().STATUS_GET(CTL);
|
|||
|
|
if (dt.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("当前库存已是出库中");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//判断出库物料是否上报mes入库
|
|||
|
|
string sql = "select * from T_MI_STOCK where CTL='" + CTL + "'";
|
|||
|
|
DataSet MES_STATUS = OracleHelper.ExecuteDataset(CommandType.Text, sql);
|
|||
|
|
string CODE = MES_STATUS.Tables[0].Rows[0]["BARCODE"].ToString();
|
|||
|
|
if (MES_STATUS.Tables[0].Rows[0]["STSEBS"].ToString() != "1" && MES_STATUS.Tables[0].Rows[0]["BARCODE"].ToString() != "000000")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox($"该箱号{CTL}对应的{BARCODE}未上报mes成功,无法出库");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//更新库存表状态--以箱号或者库位为标准
|
|||
|
|
DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataCK(BARCODE);
|
|||
|
|
if (tb != null && tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string orderstr = "CK" + DateTime.Now.ToString("yyyyMMddHHmmssffffff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.CUSTOMERMEMBERID = tb.Rows[0]["Docctnumber"].ToString(); //销售订单
|
|||
|
|
or_Model.PICKINGID = orderstr;
|
|||
|
|
//or_Model.PUTIN_ID = orderstr;
|
|||
|
|
//or_Model.OUT_ID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = tb.Rows[0]["GOODS_ID"].ToString();
|
|||
|
|
or_Model.LOC_ID = tb.Rows[0]["LOCATION_ID"].ToString();
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());//SHELVES_NUM
|
|||
|
|
or_Model.BARCODE = BARCODE;
|
|||
|
|
or_Model.CTL = tb.Rows[0]["CTL"].ToString();
|
|||
|
|
or_Model.status = "0";
|
|||
|
|
//or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = "1";
|
|||
|
|
or_Model.CUSTOMER_ID = tb.Rows[0]["CUSTOMER_ID"].ToString();
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());
|
|||
|
|
or_Model.STORAGE_AREA_ID = tb.Rows[0]["Storage_Id"].ToString();//子库编码
|
|||
|
|
or_Model.PORT = PORT;
|
|||
|
|
or_Model.MISTOCK_NUM = Convert.ToDecimal(tb.Rows[0]["packing_num"].ToString());
|
|||
|
|
or_Model.DOCCTNUMBER= tb.Rows[0]["GOODS_SKU"].ToString(); //周期 电视机显示用
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
|
|||
|
|
// IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + BARCODE);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单异常,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + BARCODE + ",异常:" + errText);
|
|||
|
|
SystemCommon.ShowInfoMessageBox("错误!" + errText);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
txtBoxCode.Text = "";
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("箱号:" + textBox2.Text + " 无库存,请确认箱码是否正确或已出库!!!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//loadForm.Dispose();
|
|||
|
|
//loadForm.Close();
|
|||
|
|
textBox4.Clear();textBox5.Clear();
|
|||
|
|
SystemCommon.ShowInfoMessageBox("出库任务已生成.");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在查询数据请等待...");
|
|||
|
|
|
|||
|
|
BindMiStockData();
|
|||
|
|
var (password, number) = GetPasswordAndNumber();//获取两个值
|
|||
|
|
textBox3.Text = number;
|
|||
|
|
//getList();
|
|||
|
|
|
|||
|
|
loadForm.Dispose();
|
|||
|
|
loadForm.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void ctrlButtons3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定预出库该:" + this.txtLocation.Text.ToString() + "物料?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
if (this.txtLocation.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择确定预出库的货物!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string Layer = txtLocation.Text.Substring(txtLocation.Text.Length - 2, 2);
|
|||
|
|
#region 寻找预出库移库库位
|
|||
|
|
string loc = IBussFactory<BussPickingWaveGoods>.Instance().getYckLoc(Layer);
|
|||
|
|
if (loc == string.Empty)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该层预出库库位已满!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Yckcommit(loc);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string GetLock(string locid)
|
|||
|
|
{
|
|||
|
|
string lockloc = string.Empty;
|
|||
|
|
string Xloc = locid.Substring(3, 2).ToString();
|
|||
|
|
string Yloc = locid.Substring(6, 2).ToString();
|
|||
|
|
string Zloc = locid.Substring(locid.Length - 1, 1);
|
|||
|
|
if (int.Parse(Xloc) > 0 && int.Parse(Xloc) < 4)
|
|||
|
|
{
|
|||
|
|
for (int j = 1; j < 4; j++)
|
|||
|
|
{
|
|||
|
|
lockloc += "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (int.Parse(Xloc) > 4 && int.Parse(Xloc) < 11)
|
|||
|
|
{
|
|||
|
|
for (int j = 5; j < 11; j++)
|
|||
|
|
{
|
|||
|
|
lockloc += "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (int.Parse(Xloc) > 11 && int.Parse(Xloc) < 18)
|
|||
|
|
{
|
|||
|
|
for (int j = 12; j < 18; j++)
|
|||
|
|
{
|
|||
|
|
lockloc += "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (int.Parse(Xloc) > 18 && int.Parse(Xloc) < 25)
|
|||
|
|
{
|
|||
|
|
for (int j = 19; j < 25; j++)
|
|||
|
|
{
|
|||
|
|
lockloc += "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (int.Parse(Xloc) > 25 && int.Parse(Xloc) < 29)
|
|||
|
|
{
|
|||
|
|
for (int j = 26; j < 29; j++)
|
|||
|
|
{
|
|||
|
|
lockloc += "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return lockloc;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string PostJSON(string url, string strPost, ref string errText)
|
|||
|
|
{
|
|||
|
|
errText = string.Empty;
|
|||
|
|
string result = string.Empty;
|
|||
|
|
//生成文件流
|
|||
|
|
byte[] buffer = Encoding.UTF8.GetBytes(strPost);
|
|||
|
|
//向流中写字符串
|
|||
|
|
StreamWriter mywriter = null;
|
|||
|
|
//根据url创建请求对象
|
|||
|
|
HttpWebRequest objrequest = (HttpWebRequest)WebRequest.Create(url);
|
|||
|
|
//设置发送方式
|
|||
|
|
objrequest.Method = "POST";
|
|||
|
|
objrequest.Timeout = 5000;
|
|||
|
|
//提交长度
|
|||
|
|
objrequest.ContentLength = buffer.Length;
|
|||
|
|
//发送内容格式
|
|||
|
|
objrequest.ContentType = "application/json";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
mywriter = new StreamWriter(objrequest.GetRequestStream());
|
|||
|
|
mywriter.Write(strPost);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
errText = ex.Message;
|
|||
|
|
result = "发送JSON失败!";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
mywriter.Close();
|
|||
|
|
}
|
|||
|
|
//读取服务器返回信息c
|
|||
|
|
HttpWebResponse objresponse = (HttpWebResponse)objrequest.GetResponse();
|
|||
|
|
using (StreamReader sr = new StreamReader(objresponse.GetResponseStream()))
|
|||
|
|
{
|
|||
|
|
result = sr.ReadToEnd();
|
|||
|
|
sr.Close();
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void Yckcommit(string locid)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (t_sts.Text.Trim() == "占用")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("不能出库,库存已经被占用");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickData(this.txtLocation.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该托盘已生成出库单!");
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string orderstr = "XJYCKD" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.PUTIN_ID = orderstr;
|
|||
|
|
or_Model.PICKINGID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = this.txtGoodsId.Text;
|
|||
|
|
or_Model.LOC_ID = this.txtLocation.Text;
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(this.txtCKnum.Text.Trim());
|
|||
|
|
|
|||
|
|
or_Model.CTL = this.txtCTL.Text;
|
|||
|
|
or_Model.status = "1";
|
|||
|
|
or_Model.outStand = locid;
|
|||
|
|
or_Model.typests = "3";
|
|||
|
|
or_Model.PROVIDER_ID = this.txtGDH.Text.Trim();
|
|||
|
|
or_Model.STORAGE_ID = "JXJW";
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(this.txtCKnum.Text.Trim());
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("手动产生预出库单成功!");
|
|||
|
|
IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
//更新移库目的位置
|
|||
|
|
IBussFactory<BussAutoRk>.Instance().UpdateYkLoc(locid);
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生预出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID);
|
|||
|
|
}
|
|||
|
|
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.txtLocation.Text.ToString() + "移库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (txtLocation.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("库位不能为空");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (t_sts.Text.Trim() == "占用")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("不能移库,库存已经被占用");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickData(this.txtLocation.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该托盘已生成出库单!");
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (textBox1.Text.Trim() == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("移库库位不能为空");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getLocS(textBox1.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("移库库位不存在或有货");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string errText = "";
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsYK(txtLocation.Text.Trim(), textBox1.Text.Trim());
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("手动产生移库单成功!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{ SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ZjcheckB_CheckedChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (comboBox1.Text.Trim() == "A2" || comboBox1.Text.Trim() == "A3")
|
|||
|
|
{
|
|||
|
|
if (ZjcheckB.Checked == true)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("追加模式只允许A1 A4库口!请选择正确出库站台");
|
|||
|
|
}
|
|||
|
|
ZjcheckB.Checked = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//if (comboBox1.Text == "A1" || comboBox1.Text == "A4")
|
|||
|
|
//{
|
|||
|
|
// if (SystemCommon.ShowMessageBoxResult("确定生成零拣:" + this.txtLocation.Text.ToString() + "任务吗?") == DialogResult.OK)
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// comboBox1.Text = "A2";
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.txtLocation.Text.ToString() + "盘点出库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string tasktype = string.Empty;
|
|||
|
|
if (txtLocation.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("库位不能为空");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (this.comboBox1.Text.Trim() == "A2" || this.comboBox1.Text.Trim() == "A3")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("盘点任务只能出A1,A4");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (txtLocation.Text.Substring(0, 2) != "JW")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("非立库库位");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (t_sts.Text.Trim() == "占用")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("不能出库,库存已经被占用");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (this.txtCKnum.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请输入出库数");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (Convert.ToDecimal(this.txtCKnum.Text.Trim()) > Convert.ToDecimal(this.txtCCNum.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("出库数不能大于库存数");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (this.txtGoodsId.Text.Trim() == "00000")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("不能手动出空托盘");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (storid == "JXJWTH")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("退货存储不能生成盘点任务!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickData(this.txtLocation.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该托盘已生成出库单!");
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//if (IBussFactory<BussPickingWaveGoods>.Instance().getPickDataCount())
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("出库任务不能多余10条!");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
string orderstr = "SJD" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.PUTIN_ID = orderstr;
|
|||
|
|
or_Model.PICKINGID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = this.txtGoodsId.Text;
|
|||
|
|
or_Model.LOC_ID = this.txtLocation.Text;
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(this.txtCKnum.Text.Trim());
|
|||
|
|
or_Model.BARCODE = barcode;
|
|||
|
|
or_Model.CTL = this.txtCTL.Text;
|
|||
|
|
or_Model.status = "1";
|
|||
|
|
or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = "1";
|
|||
|
|
or_Model.PROVIDER_ID = this.txtGDH.Text.Trim();
|
|||
|
|
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(this.txtCKnum.Text.Trim());
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("手动产生盘点出库单成功!");
|
|||
|
|
IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生盘点出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 工单ID:" + or_Model.PROVIDER_ID);
|
|||
|
|
}
|
|||
|
|
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void txtBoxCode_KeyDown(object sender, KeyEventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (e.KeyCode == Keys.Enter)
|
|||
|
|
{
|
|||
|
|
//611250110192436 外箱条码
|
|||
|
|
//BAG611250113676428 内箱条码
|
|||
|
|
//if (this.txtBoxCode.Text.Trim().Length == 15)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
string Code = this.txtBoxCode.Text.Trim();
|
|||
|
|
|
|||
|
|
if (IBussFactory<BussPickingWaveGoods>.Instance().GetPickData_BARCODE(Code))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("箱码:" + Code + "已生成出库单!");
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataCK(Code.Trim());
|
|||
|
|
if (tb != null && tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string orderstr = "CK" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.PICKINGID = tb.Rows[0]["Docctnumber"].ToString(); //销售订单
|
|||
|
|
or_Model.PUTIN_ID = orderstr;
|
|||
|
|
or_Model.OUT_ID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = tb.Rows[0]["GOODS_ID"].ToString();
|
|||
|
|
or_Model.LOC_ID = tb.Rows[0]["LOCATION_ID"].ToString();
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());//SHELVES_NUM
|
|||
|
|
or_Model.BARCODE = tb.Rows[0]["BARCODE"].ToString();
|
|||
|
|
or_Model.CTL = tb.Rows[0]["CTL"].ToString();
|
|||
|
|
or_Model.status = "0";
|
|||
|
|
//or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = "1";
|
|||
|
|
or_Model.CUSTOMER_ID = tb.Rows[0]["CUSTOMER_ID"].ToString();
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());
|
|||
|
|
or_Model.STORAGE_AREA_ID = tb.Rows[0]["Storage_Id"].ToString();//子库编码
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
|
|||
|
|
//IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 扫描产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + Code);
|
|||
|
|
}
|
|||
|
|
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
txtBoxCode.Text = "";
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("箱号:" + Code + " 无库存,请确认箱码是否正确或已出库!!!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void txtBoxCode_Leave(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// this.txtBoxCode.Select();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (textBox2.Text == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请输入数量");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择空箱出库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
//int[] rownumber = GVMiStock.GetSelectedRows();
|
|||
|
|
if (!int.TryParse(textBox2.Text, out int quantity) || quantity <= 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请输入正确的数量(必须为正整数)");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//if (this.txtGoodsId.Text != "000000")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("请选择空料箱任务,物料编号000000");
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
int numbers = 0;
|
|||
|
|
//查询当前库存空箱子数
|
|||
|
|
DataTable number = IBussFactory<BussMIStock>.Instance().GetMisDataempty();
|
|||
|
|
if(number.Rows.Count == 0){ SystemCommon.ShowInfoMessageBox($"无空箱"); return; }
|
|||
|
|
if(number.Rows.Count<= int.Parse(textBox2.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox($"库内在库空箱数量{number.Rows.Count},实际需求{int.Parse(textBox2.Text)},全出");
|
|||
|
|
numbers = number.Rows.Count;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
numbers = int.Parse(textBox2.Text);
|
|||
|
|
}
|
|||
|
|
//根据选定数量进行出库
|
|||
|
|
for (int i = 1; i <= numbers; i++)
|
|||
|
|
{
|
|||
|
|
//执行一空箱出库
|
|||
|
|
DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataCKCTL();
|
|||
|
|
if (tb != null && tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string orderstr = "CK" + DateTime.Now.ToString("yyyyMMddHHmmssfff")+ tb.Rows[0]["CTL"].ToString();
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.PICKINGID = tb.Rows[0]["Docctnumber"].ToString(); //销售订单
|
|||
|
|
or_Model.PUTIN_ID = orderstr;
|
|||
|
|
or_Model.OUT_ID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = tb.Rows[0]["GOODS_ID"].ToString();
|
|||
|
|
or_Model.LOC_ID = tb.Rows[0]["LOCATION_ID"].ToString();
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());//SHELVES_NUM
|
|||
|
|
or_Model.BARCODE = textBox2.Text.Trim();
|
|||
|
|
or_Model.CTL = tb.Rows[0]["CTL"].ToString();
|
|||
|
|
or_Model.status = "0";
|
|||
|
|
//or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = "1";
|
|||
|
|
or_Model.CUSTOMER_ID = tb.Rows[0]["CUSTOMER_ID"].ToString();
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());
|
|||
|
|
or_Model.STORAGE_AREA_ID = tb.Rows[0]["Storage_Id"].ToString();//子库编码
|
|||
|
|
or_Model.PORT = "0";
|
|||
|
|
or_Model.MISTOCK_NUM = Convert.ToDecimal(tb.Rows[0]["packing_num"].ToString());
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
|
|||
|
|
////IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
//LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + this.textBox2.Text);
|
|||
|
|
}
|
|||
|
|
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
txtBoxCode.Text = "";
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("箱号:" + textBox2.Text + " 无库存,请确认箱码是否正确或已出库!!!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
SystemCommon.ShowInfoMessageBox("空箱出库任务批量下发成功");
|
|||
|
|
string tasktype = string.Empty;
|
|||
|
|
//DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataCKCTL(textBox2.Text.Trim());
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
string number = textBox3.Text;
|
|||
|
|
if(number==""||number==null)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("点击刷新获取最新的限制数量");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (!Regex.IsMatch(number, @"^[1-9]\d*$"))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请输入正确的正整数");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
var (password, num) = GetPasswordAndNumber();//获取两个值
|
|||
|
|
TextBox txtInput = new TextBox
|
|||
|
|
{
|
|||
|
|
Width = 200,
|
|||
|
|
PasswordChar = '*',
|
|||
|
|
Anchor = AnchorStyles.None // 取消锚定,便于居中
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
Form prompt = new Form
|
|||
|
|
{
|
|||
|
|
Width = 300,
|
|||
|
|
Height = 150,
|
|||
|
|
Text = "密码验证",
|
|||
|
|
StartPosition = FormStartPosition.CenterScreen,
|
|||
|
|
FormBorderStyle = FormBorderStyle.FixedDialog, // 固定对话框样式
|
|||
|
|
MaximizeBox = false,
|
|||
|
|
MinimizeBox = false
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
System.Windows.Forms.Label lblPrompt = new System.Windows.Forms.Label
|
|||
|
|
{
|
|||
|
|
Text = "请输入密码:",
|
|||
|
|
AutoSize = true,
|
|||
|
|
Anchor = AnchorStyles.None // 取消锚定
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
Button btnOK = new Button
|
|||
|
|
{
|
|||
|
|
Text = "确定",
|
|||
|
|
Width = 80,
|
|||
|
|
Anchor = AnchorStyles.None
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 使用 TableLayoutPanel 实现居中布局
|
|||
|
|
TableLayoutPanel tableLayout = new TableLayoutPanel
|
|||
|
|
{
|
|||
|
|
Dock = DockStyle.Fill,
|
|||
|
|
ColumnCount = 1,
|
|||
|
|
RowCount = 3,
|
|||
|
|
Padding = new Padding(20)
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 添加控件到 TableLayoutPanel
|
|||
|
|
tableLayout.Controls.Add(lblPrompt, 0, 0);
|
|||
|
|
tableLayout.Controls.Add(txtInput, 0, 1);
|
|||
|
|
tableLayout.Controls.Add(btnOK, 0, 2);
|
|||
|
|
|
|||
|
|
// 设置行和列的样式
|
|||
|
|
tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
|||
|
|
tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
|||
|
|
tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
|||
|
|
|
|||
|
|
// 设置控件在单元格内的居中
|
|||
|
|
lblPrompt.Anchor = AnchorStyles.None;
|
|||
|
|
txtInput.Anchor = AnchorStyles.None;
|
|||
|
|
btnOK.Anchor = AnchorStyles.None;
|
|||
|
|
|
|||
|
|
// 按钮点击事件
|
|||
|
|
btnOK.Click += (s, ev) => prompt.Close();
|
|||
|
|
|
|||
|
|
// 将 TableLayoutPanel 添加到窗体
|
|||
|
|
prompt.Controls.Add(tableLayout);
|
|||
|
|
|
|||
|
|
prompt.ShowDialog();
|
|||
|
|
|
|||
|
|
if (txtInput.Text != password)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("密码验证失败");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string sql = "update T_CK_NUMBER set NUM ='"+ number + "'";
|
|||
|
|
int row=OracleHelper.ExecuteNonQuery(CommandType.Text, sql);
|
|||
|
|
if (row > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("更新出库任务数量限制成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("更新出库任务数量限制失败");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons8_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定选择物料出库吗?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
int[] rownumber = GVMiStock.GetSelectedRows();
|
|||
|
|
|
|||
|
|
if (rownumber.Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择出库物料");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string PORT = "0";
|
|||
|
|
if (this.comboBox2.Text == "请选择装箱口")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择装箱口");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (this.comboBox2.Text == "平均分")
|
|||
|
|
{
|
|||
|
|
PORT = "0";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
PORT = this.comboBox2.Text;
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i < rownumber.Length; i++)
|
|||
|
|
{
|
|||
|
|
string BARCODE = "000000";
|
|||
|
|
string CTL = GVMiStock.GetRowCellValue(rownumber[i], "CTL").ToString();
|
|||
|
|
string tasktype = string.Empty;
|
|||
|
|
DataSet dt = IBussFactory<BussMIStock>.Instance().STATUS_GET(CTL);
|
|||
|
|
if (dt.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("当前库存已是出库中");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//更新库存表状态--以箱号或者库位为标准
|
|||
|
|
DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataCK_1(BARCODE);
|
|||
|
|
if (tb != null && tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string orderstr = "CK" + DateTime.Now.ToString("yyyyMMddHHmmssffffff");
|
|||
|
|
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
|
|||
|
|
or_Model.CUSTOMERMEMBERID = tb.Rows[0]["Docctnumber"].ToString(); //销售订单
|
|||
|
|
or_Model.PICKINGID = orderstr;
|
|||
|
|
//or_Model.PUTIN_ID = orderstr;
|
|||
|
|
//or_Model.OUT_ID = orderstr;
|
|||
|
|
or_Model.GOOD_ID = tb.Rows[0]["GOODS_ID"].ToString();
|
|||
|
|
or_Model.LOC_ID = tb.Rows[0]["LOCATION_ID"].ToString();
|
|||
|
|
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
|
|||
|
|
or_Model.PICKING_NUM = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());//SHELVES_NUM
|
|||
|
|
or_Model.BARCODE = BARCODE;
|
|||
|
|
or_Model.CTL = tb.Rows[0]["CTL"].ToString();
|
|||
|
|
or_Model.status = "0";
|
|||
|
|
//or_Model.outStand = this.comboBox1.Text.Trim();
|
|||
|
|
or_Model.typests = "1";
|
|||
|
|
or_Model.CUSTOMER_ID = tb.Rows[0]["CUSTOMER_ID"].ToString();
|
|||
|
|
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(tb.Rows[0]["SHELVES_NUM"].ToString());
|
|||
|
|
or_Model.STORAGE_AREA_ID = tb.Rows[0]["Storage_Id"].ToString();//子库编码
|
|||
|
|
or_Model.PORT = PORT;
|
|||
|
|
or_Model.MISTOCK_NUM = Convert.ToDecimal(tb.Rows[0]["packing_num"].ToString());
|
|||
|
|
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
|
|||
|
|
if (errText.Length == 0)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
|
|||
|
|
// IBussFactory<BussOrders>.Instance().UpdateLock(txtLocation.Text.Trim());
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + BARCODE);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单异常,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 箱码:" + BARCODE + ",异常:" + errText);
|
|||
|
|
SystemCommon.ShowInfoMessageBox("错误!" + errText);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
getList();
|
|||
|
|
BindMiStockData();
|
|||
|
|
txtBoxCode.Text = "";
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("箱号:" + textBox2.Text + " 无库存,请确认箱码是否正确或已出库!!!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//loadForm.Dispose();
|
|||
|
|
//loadForm.Close();
|
|||
|
|
|
|||
|
|
SystemCommon.ShowInfoMessageBox("出库任务已生成.");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|