private void QueryStockEventHandler(object sender, QueryStockEventArgs e) { queryHouseName = e.StoreHouse; queryProductStasus = e.ProductStatus; queryWorkFlowStatus = e.WorkFolwStatus; queryRowth = e.Rowth; queryColumnth = e.Columnth; queryLayerth = e.Layerth; queryGsStoreStatus = e.GsStoreStatus; queryGsRunStatus = e.GsRunStatus; queryGsTaskType = e.GsTaskType; queryProductBatchNum = e.ProductBatchNum; bool openProgress = this.View.OpenProgressBar(); if (!openProgress) { return; } List <View_QueryStockListModel> modelList = bllQueryStockList.GetModelList(e.StoreHouse, e.Rowth, e.Columnth, e.Layerth, e.ProductStatus, e.WorkFolwStatus , e.GsRunStatus, e.GsStoreStatus, e.GsTaskType, e.ProductBatchNum); this.View.SetExitButtonEnabled(false); this.View.RefreshDGVData(modelList); int allCoreNum = 0; for (int i = 0; i < modelList.Count; i++) { System.Threading.Thread.Sleep(0); this.View.FormDoEvent(); List <View_StockListDetailModel> stockDetailModelList = bllView_StockDetail.GetStockDetailByGsID(modelList[i].GoodsSiteID); List <TB_Tray_indexModel> trayDetailModelList = new List <TB_Tray_indexModel>(); if (stockDetailModelList != null) { for (int j = 0; j < stockDetailModelList.Count; j++) { this.View.FormDoEvent(); System.Threading.Thread.Sleep(0); TB_Tray_indexModel trayDetailModel = bllTrayDetail.GetModel(stockDetailModelList[j].TrayID);//查询料框电芯详细 if (trayDetailModel != null) { allCoreNum += (int)trayDetailModel.Tf_CellCount; } } } } this.View.ShowTrayCoreNum(allCoreNum.ToString()); this.View.CloseProgressBar(); this.View.SetExitButtonEnabled(true); }
private void StockDetailEventHandler(object sender, QueryGoodsSiteEventArgs e) { List <View_StockListDetailModel> stockDetailModelList = bllView_StockDetail.GetStockDetailByGsID(e.GoodsSiteID); List <TB_Tray_indexModel> trayDetailModelList = new List <TB_Tray_indexModel>(); if (stockDetailModelList != null) { for (int i = 0; i < stockDetailModelList.Count; i++) { TB_Tray_indexModel trayDetailModel = bllTrayDetail.GetModel(stockDetailModelList[i].TrayID);//查询料框电芯详细 trayDetailModelList.Add(trayDetailModel); } } this.View.ShowStockDetail(stockDetailModelList, trayDetailModelList); }
private void RefreshStockDetail(int gsID) { View_QueryStockListModel viewStockListModel = bllView_QueryStockList.GetModelByGSID(gsID); if (viewStockListModel != null) { StockListModel slModel = bllStockList.GetModel(viewStockListModel.StockListID); currStockListModel = slModel; } List <View_StockListDetailModel> stockDetailModelList = bllView_StockDetail.GetStockDetailByGsID(gsID); List <TB_Tray_indexModel> trayDetailModelList = new List <TB_Tray_indexModel>(); if (stockDetailModelList != null) { for (int i = 0; i < stockDetailModelList.Count; i++) { TB_Tray_indexModel trayDetailModel = bllTrayDetail.GetModel(stockDetailModelList[i].TrayID);//查询料框电芯详细 trayDetailModelList.Add(trayDetailModel); } } this.View.ShowStockDetail(stockDetailModelList, trayDetailModelList); }
/// <summary> /// 托盘解绑 /// </summary> /// <param name="trayID"></param> private bool TrayUninstall(string trayID, ref string reStr) { reStr = "解绑托盘" + trayID + "成功"; //服务器注销托盘 string strWhere = string.Format("Tf_TrayId='{0}' and tf_traystat=1", trayID); List <TB_Tray_indexModel> trayList = gxTrayBll.GetModelList(strWhere); if (trayList != null && trayList.Count > 0) { TB_Tray_indexModel tray = trayList[0]; if (tray != null) { tray.tf_traystat = 0; if (!gxTrayBll.Update(tray)) { reStr = "解绑" + trayID + "失败,更新杭可托盘信息表失败"; return(false); } } } //删除本地 ocvPalletBll.Delete(trayID); return(true); }
/// <summary> /// 上传电芯数据到客户的数据库系统 /// </summary> /// <param name="palletID"></param> /// <param name="batchID"></param> /// <param name="batteryIDs"></param> /// <param name="reStr"></param> /// <returns></returns> private bool UploadFillInfoToGX(string palletID, string batchID, string[] batteryIDs, bool batchNumEnable, ref string reStr) { // 1、 查询批次信息表(TB_Batch_Index)得到批次编号和批次类型 // 2、 插入托盘信息到托盘信息表(TB_Tray_index)中 // 3、 更新批次信息表(TB_Batch_Index)中托盘数量和电池总数量 // 4、 插入电池信息到电池信息表(TB_After_GradeData) reStr = ""; try { TB_Batch_IndexModel batchModel = gxBatchBll.GetModel(batchID); if (batchModel == null) { reStr = "批次:" + batchID + "不存在"; return(false); } //1 检查托盘信息 if (gxTrayBll.Exists(palletID)) { reStr = "托盘:" + palletID + "已经存在"; return(false); } //2 坚持查电芯数据是否合格 for (int i = 0; i < batteryIDs.Count() - 1; i++) { int row1 = i / 12 + 1; int col1 = i - (row1 - 1) * 12 + 1; if (string.IsNullOrWhiteSpace(batteryIDs[i])) { continue; } if (batteryIDs[i].Length < 12) //modify by zwx,2015-07-23 { reStr = "输入电芯条码错误:第" + (i + 1).ToString() + "个电芯条码不足12位"; return(false); } for (int j = i + 1; j < batteryIDs.Count(); j++) { int row2 = j / 12 + 1; int col2 = j - (row2 - 1) * 12 + 1; if (batteryIDs[i] == batteryIDs[j]) { reStr = "输入电芯条码有重复:第[" + row1.ToString() + "行," + col1.ToString() + "列]和[" + row2.ToString() + "行," + col2.ToString() + "列]电芯条码有重复"; return(false); } } } TB_Tray_indexModel trayModel = new TB_Tray_indexModel(); trayModel.Tf_BatchID = batchID; trayModel.Tf_Batchtype = batchModel.Tf_Batchtype; trayModel.Tf_CellCount = 0; trayModel.Tf_TrayId = palletID; trayModel.tf_CheckInTime = System.DateTime.Now; gxTrayBll.Add(trayModel); //3插入电池信息 int batteryCount = 0; for (int i = 0; i < batteryIDs.Count(); i++) { if (string.IsNullOrWhiteSpace(batteryIDs[i]) || batteryIDs[i].Length < 12) //modify by zwx,2015-07-23 { continue; } //若已存在电芯,更新其绑定的托盘号 List <TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList("Tf_CellSn = '" + batteryIDs[i] + "' and Tf_BatchID='" + batchID + "' ");// modify by zwx,2015-12-13 if (batteryList != null && batteryList.Count > 0) { TB_After_GradeDataModel battery = batteryList[0]; if (battery != null) { string oldTrayID = battery.Tf_TrayId; battery.Tf_TrayId = palletID; battery.Tf_BatchID = batchID; battery.Tf_ChannelNo = (i + 1); battery.Tf_Pick = null; battery.Tf_Tag = 0; gxBatteryBll.Update(battery, oldTrayID); batteryCount++; } } else { TB_After_GradeDataModel batteryModel = new TB_After_GradeDataModel(); batteryModel.Tf_BatchID = batchID; batteryModel.Tf_Batchtype = batchModel.Tf_Batchtype; batteryModel.Tf_TrayId = palletID; batteryModel.Tf_ChannelNo = (i + 1); batteryModel.Tf_CellSn = batteryIDs[i]; if (gxBatteryBll.Add(batteryModel)) { batteryCount++; } } } trayModel.Tf_CellCount = batteryCount; if (!gxTrayBll.Update(trayModel)) { reStr = "更新托盘数据表出现错误"; ocvPalletBll.Delete(palletID); string strWhere = "Tf_TrayId='" + palletID + "' and Tf_BatchID='" + batchID + "' "; List <TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere); foreach (TB_After_GradeDataModel battery in batteryList) { if (battery == null) { continue; } gxBatteryBll.Delete(battery.Tf_BatchID, battery.Tf_TrayId, battery.Tf_CellSn); } gxTrayBll.Delete(palletID); return(false); } //2 更新批次信息 batchModel.Tf_TrayCount++; if (batchNumEnable) { batchModel.Tf_CellCount += trayModel.Tf_CellCount; } gxBatchBll.Update(batchModel); return(true); } catch (System.Exception ex) { string strWhere = "Tf_TrayId='" + palletID + "' and Tf_BatchID='" + batchID + "' "; List <TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere); foreach (TB_After_GradeDataModel battery in batteryList) { if (battery == null) { continue; } gxBatteryBll.Delete(battery.Tf_BatchID, battery.Tf_TrayId, battery.Tf_CellSn); } gxTrayBll.Delete(palletID); MessageBox.Show("录入数据库出现异常,可能有重复的电芯条码,请检查," + ex.Message); return(false); } }
private void GetFillInfo(string palletID) { string dbSet = this.comboBoxDBset_BL.Text; if (string.IsNullOrWhiteSpace(dbSet)) { MessageBox.Show("未设定入库类型"); return; } if (dbSet == "初入库") { OCVPalletModel palletModel = ocvPalletBll.GetModel(palletID); if (palletModel == null) { MessageBox.Show("提示:本地信息库里未找到该托盘号信息"); return; } this.labelWarn.Text = ""; this.comboBoxBatch_BL.Text = palletModel.batchID; this.textBoxCurrentBatch_BL.Text = palletModel.batchID; this.dataGridViewBatterys_BL.Rows.Clear(); for (int i = 0; i < 4; i++) { //if (i <3) { this.dataGridViewBatterys_BL.Rows.Add(); } this.dataGridViewBatterys_BL.RowCount = this.dataGridViewBatterys_BL.Rows.Count; DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[i]; //DataRow dr = dt.NewRow(); for (int j = 0; j < 12; j++) { dr.Cells[j].Value = ""; } } string strWhere = "palletID = '" + palletID + "'"; // List<TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere); List <OCVBatteryModel> batteryList = ocvBatteryBll.GetModelList(strWhere); for (int i = 0; i < batteryList.Count(); i++) { //TB_After_GradeDataModel battery = batteryList[i]; OCVBatteryModel battery = batteryList[i]; if (battery == null) { continue; } int rowIndex = (int)battery.rowIndex - 1; // (int)(battery.Tf_ChannelNo - 1) / 12; int cowIndex = (int)battery.columnIndex - 1; // (int)battery.Tf_ChannelNo - rowIndex * 12 - 1; DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[rowIndex]; dr.Cells[cowIndex].Value = battery.batteryID; // battery.Tf_CellSn; } } else if (dbSet == "二次分容入库") { TB_Tray_indexModel trayModel = gxTrayBll.GetModel(palletID); if (trayModel == null) { MessageBox.Show("提示:国轩托盘信息库里未找到该托盘号信息"); return; } this.labelWarn.Text = ""; this.comboBoxBatch_BL.Text = trayModel.Tf_BatchID; this.textBoxCurrentBatch_BL.Text = trayModel.Tf_BatchID; if (this.dataGridViewBatterys_BL.Rows.Count > 0) { this.dataGridViewBatterys_BL.Rows.Clear(); } for (int i = 0; i < 4; i++) { if (i < 3) { this.dataGridViewBatterys_BL.Rows.Add(); } this.dataGridViewBatterys_BL.RowCount = this.dataGridViewBatterys_BL.Rows.Count; DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[i]; //DataRow dr = dt.NewRow(); for (int j = 0; j < 12; j++) { dr.Cells[j].Value = ""; } } string strWhere = " Tf_TrayId = '" + palletID + "' and Tf_BatchID='" + trayModel.Tf_BatchID + "' "; List <TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere); for (int i = 0; i < batteryList.Count(); i++) { TB_After_GradeDataModel battery = batteryList[i]; if (battery == null) { continue; } int rowIndex = (int)(battery.Tf_ChannelNo - 1) / 12; int cowIndex = (int)battery.Tf_ChannelNo - rowIndex * 12 - 1; DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[rowIndex]; dr.Cells[cowIndex].Value = battery.Tf_CellSn; } } else { MessageBox.Show("入库类型设置错误"); return; } this.dataGridViewBatterys_BL.BeginEdit(false); this.dataGridViewBatterys_BL.CurrentCell = null; }
private void InStoreByHandEventHandler(object sender, InStoreByHandEventArgs e) { int taskTypeCode = (int)(EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.TaskTypeName); TaskTypeModel taskType = bllTaskType.GetModel(taskTypeCode); GoodsSiteModel goodsSiteModel = null; string[] trayIDs = SplitStringArray(e.TrayIDs); if (trayIDs != null) { for (int i = 0; i < trayIDs.Length; i++) { TB_Tray_indexModel trayModel = bllTbTrayIndex.GetModel(trayIDs[i]); if (trayModel == null) { this.View.ShowMessage("信息提示", "条码:“" + trayIDs[i] + "”不存在此条码信息,请重新输入"); return; } } } int createStatus = this.View.AskMessBox("您确定要手动生成“" + e.TaskTypeName + "”任务么?"); if (createStatus == 0) { if (taskType != null)//控制任务接口插入一个任务申请 { if (taskType.TaskTypeCode == (int)EnumTaskName.空料框出库) { //查询空料框 goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.StartLogicAreaID, EnumGSStoreStatus.空料框, EnumGSRunStatus.任务完成, EnumGSType.货位); if (goodsSiteModel == null) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!"); } return; } else { ControlInterfaceModel controlInterModel = new ControlInterfaceModel(); controlInterModel.CreateTime = DateTime.Now; controlInterModel.DeviceCode = taskType.EndDevice; controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString(); controlInterModel.InterfaceType = EnumTaskCategory.出库.ToString(); //生成控制条码 需要跟控制层 controlInterModel.TaskCode = bllControlInter.GetNewTaskCode(); controlInterModel.InterfaceParameter = e.TrayIDs; long controlInterID = bllControlInter.Add(controlInterModel); if (controlInterID != 1) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“" + e.TaskTypeName + "”任务成功!"); //mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "手动生成“" + e.TaskTypeName + "”任务成功!"); } } } } else if (taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_B1 || taskType.TaskTypeCode == (int)EnumTaskName.分容入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.空料框入库) { goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.EndLogicAreaID, EnumGSStoreStatus.空货位, EnumGSRunStatus.待用, EnumGSType.货位); if (goodsSiteModel == null) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!"); } return; } else { ControlInterfaceModel controlInterModel = new ControlInterfaceModel(); controlInterModel.CreateTime = DateTime.Now; controlInterModel.DeviceCode = taskType.StartDevice; controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString(); controlInterModel.InterfaceType = EnumTaskCategory.入库.ToString(); controlInterModel.InterfaceParameter = e.TrayIDs; controlInterModel.TaskCode = bllControlInter.GetNewTaskCode(); long controlInterID = bllControlInter.Add(controlInterModel); if (controlInterID != 1) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“" + e.TaskTypeName + "”任务成功!"); } } } } } DataTable dtCtrlTaskList = bllControlTask.GetCtrlDatatable(this.currentEnumTaskName, this.currentEnumTaskStatus , this.currentHouseName, this.currentCreateMode, this.currentTaskType); this.View.ShowControlTaskData(dtCtrlTaskList); } }
private void AddTrayEventHandler(object sender, TrayEventArgs e) { if (e.GsRunStatus != EnumGSRunStatus.任务完成.ToString()) { this.View.ShowMessage("信息提示", "货位正在运行不允许添加料框信息!"); return; } if (this.currentSelectGSID != 999999) { View_QueryStockListModel viewStockListModel = bllView_QueryStockList.GetModelByGSID(currentSelectGSID); if (viewStockListModel != null) { TB_Tray_indexModel trayModel = bllTrayIndex.GetModel(e.TrayID); if (trayModel == null) { this.View.ShowMessage("信息提示", "条码在数据库不存在!"); return; } if (currStockListModel != null) { List <StockDetailModel> stockDetailList = bllStockDetail.GetDetailModelList(currStockListModel.StockListID); if (stockDetailList != null) { if (viewStockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString()) { if (stockDetailList.Count >= 2) { this.View.ShowMessage("信息提示", "A库房每个货位只能存储2个料框!"); return; } } else if (viewStockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString()) { if (stockDetailList.Count >= 6) { this.View.ShowMessage("信息提示", "B库房每个货位只能存储6个料框!"); return; } } bool isTheSame = true; for (int i = 0; i < stockDetailList.Count; i++) { TB_Tray_indexModel existTrayModel = bllTrayIndex.GetModel(stockDetailList[i].TrayID); if (existTrayModel.Tf_BatchID != trayModel.Tf_BatchID) { isTheSame = false; this.View.ShowMessage("信息提示", "您添加的托盘号所属批次号与现有库存的托盘批次不一致!若您要添加请将现有库存的托盘删除!"); break; } } if (isTheSame == false) { return; } } } StockDetailModel stockDetailModel = new StockDetailModel(); stockDetailModel.TrayID = e.TrayID; stockDetailModel.StockListID = viewStockListModel.StockListID; bllStockDetail.Add(stockDetailModel); currStockListModel.ProductBatchNum = trayModel.Tf_BatchID; bllStockList.Update(currStockListModel);//更新库存列表 RefreshStockDetail(currentSelectGSID); this.mainPre.View.AddLog(EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",添加条码+" + trayModel.Tf_TrayId + ",货位号:" + viewStockListModel.GoodsSiteName); } else { this.View.ShowMessage("信息提示", "此货位没有库存信息!"); } } else { this.View.ShowMessage("信息提示", "请选择要添加料框的货位!"); } }