/// <summary> /// 校验回温时间和烘烤温度不能为空 /// </summary> /// <param name="curDgvr"></param> /// <param name="checkMsg"></param> /// <returns></returns> private bool CheckTime(DataGridViewRow curDgvr, out string checkMsg) { foreach (DataGridViewRow dgvr in dgv_SencondClass.Rows) { if (dgvr.Index == curDgvr.Index) { continue; } if (!(dgvr.Cells["TemperatureMaxTime"].Value == null && dgvr.Cells["TemperatureMinTime"].Value == null)) { if (SqlInput.ChangeNullToInt(dgvr.Cells["TemperatureMaxTime"].Value, 0) >= SqlInput.ChangeNullToInt(curDgvr.Cells["TemperatureMaxTime"].Value, 0) && SqlInput.ChangeNullToInt(dgvr.Cells["TemperatureMinTime"].Value, 0) <= SqlInput.ChangeNullToInt(curDgvr.Cells["TemperatureMaxTime"].Value, 0) || SqlInput.ChangeNullToInt(dgvr.Cells["TemperatureMaxTime"].Value, 0) >= SqlInput.ChangeNullToInt(curDgvr.Cells["TemperatureminTime"].Value, 0) && SqlInput.ChangeNullToInt(dgvr.Cells["TemperatureMinTime"].Value, 0) <= SqlInput.ChangeNullToInt(curDgvr.Cells["TemperatureminTime"].Value, 0)) { checkMsg = "回温时间不能交叉"; return(false); } } // if (!(dgvr.Cells["RoastMaxTemperature"].Value == null && dgvr.Cells["RoastMinTemperature"].Value == null)) // { // if (SqlInput.ChangeNullToInt(dgvr.Cells["RoastMaxTemperature"].Value, 0) >= SqlInput.ChangeNullToInt(curDgvr.Cells["RoastMaxTemperature"].Value, 0) //&& SqlInput.ChangeNullToInt(dgvr.Cells["RoastMinTemperature"].Value, 0) <= SqlInput.ChangeNullToInt(curDgvr.Cells["RoastMaxTemperature"].Value, 0) //|| SqlInput.ChangeNullToInt(dgvr.Cells["RoastMaxTemperature"].Value, 0) >= SqlInput.ChangeNullToInt(curDgvr.Cells["RoastMinTemperature"].Value, 0) //&& SqlInput.ChangeNullToInt(dgvr.Cells["RoastMinTemperature"].Value, 0) <= SqlInput.ChangeNullToInt(curDgvr.Cells["RoastMinTemperature"].Value, 0)) // { // checkMsg = "烘烤温度不能交叉"; // return false; // } // } } checkMsg = "OK"; return(true); }
/// <summary> /// 产品初始化 /// </summary> /// <param name="SN"></param> /// <returns></returns> public static bool Init(string SN, string sfcno, ref string msg) { string strSql = string.Format(@"SELECT A.TBPS_ID,B.OVER_FLAG FROM T_Bllb_productKey_tbpk A LEFT JOIN dbo.T_Bllb_productInfo_tbpi B ON B.TBPS_ID = A.TBPS_ID WHERE A.KEY_SN='{0}' AND B.SfcNo='{1}'", SN, sfcno); DataTable dt_ID = NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt_ID.Rows.Count == 0) { strSql = string.Format(@"SELECT TBPS_ID,OVER_FLAG FROM dbo.T_Bllb_productInfo_tbpi WHERE SERIAL_NUMBER='{0}' AND SfcNo='{1}' AND LAST_FLAG='Y' ORDER BY INPUT_TIME DESC", SN, sfcno); dt_ID = NMS.QueryDataTable(PubUtils.uContext, strSql); } if (dt_ID.Rows.Count == 0) { msg = "当前制令单中未找到此产品SN"; return(false); } strSql = string.Format(@"DELETE FROM dbo.T_Bllb_productInfo_tbpi WHERE TBPS_ID='{0}' DELETE FROM dbo.T_Bllb_productKey_tbpk WHERE TBPS_ID='{0}' DELETE FROM dbo.T_Bllb_productStatus_tbps WHERE TBPS_ID='{0}' ", dt_ID.Rows[0][0].ToString()); if (SqlInput.ChangeNullToString(dt_ID.Rows[0]["OVER_FLAG"]) == "Y") { strSql += string.Format(@" UPDATE dbo.SfcDatProduct SET InputQty=InputQty-1,ActQty=ActQty-1 WHERE SfcNo='{0}'", sfcno); } else { strSql += string.Format(@" UPDATE dbo.SfcDatProduct SET InputQty=InputQty-1 WHERE SfcNo='{0}'", sfcno); } return(NMS.ExecTransql(PubUtils.uContext, strSql)); }
private bool ValidateDocHead(out string msg) { if (cbo_Type.SelectedValue.ToString() == "-1") { msg = "请先选择单据类型"; return(false); } if (string.IsNullOrEmpty(txtBeforeDoc.Text.Trim())) { msg = "请输入上游单据"; return(false); } string sqlcmd = string.Format("SELECT FGuid,SfcNo,WoCode,TBT_ID,Product,Line FROM SfcDatProduct WHERE SfcNo='{0}'", txtBeforeDoc.Text.Trim()); DataTable dt_sfcno = CIT.Wcf.Utils.NMS.QueryDataTable(CIT.MES.PubUtils.uContext, sqlcmd); //if (dt_sfcno.Rows.Count == 0) //{ // msg = "上游单据错误"; // return false; //} if (dt_sfcno.Rows.Count > 0) { _PLCode = SqlInput.ChangeNullToString(dt_sfcno.Rows[0]["Line"]); //线别代码 _WoCode = SqlInput.ChangeNullToString(dt_sfcno.Rows[0]["WoCode"]); //工单 _SfcNo = SqlInput.ChangeNullToString(dt_sfcno.Rows[0]["SfcNo"]); //制令单 } msg = "OK"; return(true); }
private void tol_del_Click(object sender, EventArgs e) { if (dgv_po.CurrentCell == null || dgv_po.CurrentCell.RowIndex == -1) { new PubUtils().ShowNoteNGMsg("请先选中行", 2, grade.OrdinaryError); return; } DataGridViewRow dgvr = dgv_po.Rows[dgv_po.CurrentCell.RowIndex]; if (SqlInput.ChangeNullToString(dgvr.Cells["PO类型编码"].Value) != "客供单") { new PubUtils().ShowNoteNGMsg("仅客供单可以删除", 2, grade.OrdinaryError); return; } string POCode = SqlInput.ChangeNullToString(dgvr.Cells["PO订单编号"].Value); DataTable dt = BLL_Bllb_POMain_tbpm.GetPostatus(POCode); if (dt.Select("CurrentReceiveQty<>0 or ClearQty<>0").Length > 0) { MsgBox.Error("已收数量或者清点数量不为零时,不可以删除"); return; } else { BLL_Bllb_POMain_tbpm.DeletePocode(POCode); new PubUtils().ShowNoteOKMsg("删除成功"); QueryData(); } }
/// <summary> /// 打印标签(根据标签数据源打印) /// </summary> /// <param name="printTemplateName">标签名</param> /// <param name="Value">关键值</param> /// <param name="msg">返回信息</param> /// <returns></returns> public static bool PrintTemplet(string printTemplateName, string Value, ref string msg) { Dictionary <string, string> dic = new Dictionary <string, string>(); string strSql = string.Format(@"SELECT LabelSQL FROM T_Bllb_LabelSource_tbls WHERE LabelName='{0}'", printTemplateName); DataTable dt_LabelSQL = NMS.QueryDataTable(PubUtils.uContext, strSql);//获取标签的SQL语句 if (dt_LabelSQL.Rows.Count > 0) { string labelSql = SqlInput.ChangeNullToString(dt_LabelSQL.Rows[0][0]); if (labelSql == string.Empty) { msg = "标签数据源SQL语句为空"; return(false); } DataTable dt_lableSource = NMS.QueryDataTable(PubUtils.uContext, string.Format(labelSql, Value));//执行获取数据SQL语句 foreach (DataColumn dc in dt_lableSource.Columns) { dic.Add(dc.ColumnName, dt_lableSource.Rows[0][dc.ColumnName].ToString()); } } else { msg = "标签" + printTemplateName + "没有SQL语句"; return(false); } return(CIT.MES.IO.InOutPut.PrintTemplet(printTemplateName, dic)); }
/// <summary> /// 校验附料盘 /// </summary> /// <returns></returns> private bool CheckFSn(out string result_sn) { result_sn = string.Empty; if (txtMsn.Text == txtFsn.Text) { new PubUtils().ShowNoteNGMsg("附料盘与主料盘不能相同", 1, grade.OrdinaryError); return(false); } string serialnumber = txtFsn.Text; DataTable dtval = Bll_Bllb_StockInfo_tbsi.ValidateSN(serialnumber); if (dtval.Rows.Count == 0) { new PubUtils().ShowNoteNGMsg("料盘编码不在库或数量为0", 1, grade.OrdinaryError); return(false); } if (materialcode != dtval.Rows[0]["MaterialCode"].ToString()) { new PubUtils().ShowNoteNGMsg("主料盘与该料盘的料号不一致", 1, grade.OrdinaryError); return(false); } if (trv_node.Nodes.Find(result_sn, true).Length > 0) { new PubUtils().ShowNoteNGMsg("该料盘编码已存在", 1, grade.OrdinaryError); return(false); } result_sn = dtval.Rows[0]["SerialNumber"].ToString(); dicTrvSn.Add(result_sn, SqlInput.ChangeNullToInt(dtval.Rows[0]["Qty"], 0)); currentQty += SqlInput.ChangeNullToInt(dtval.Rows[0]["Qty"], 0); lblTotal.Text = currentQty.ToString(); return(true); }
private void tol_del_Click(object sender, EventArgs e) { if (dgv_DocCollect.CurrentCell == null || dgv_DocCollect.CurrentCell.RowIndex == -1) { new PubUtils().ShowNoteNGMsg("请先选中行", 2, grade.OrdinaryError); return; } DataGridViewRow dgvr = dgv_DocCollect.Rows[dgv_DocCollect.CurrentCell.RowIndex]; string s_doc_no = SqlInput.ChangeNullToString(dgvr.Cells["S_Doc_NO"].Value); DataTable dt = BLL_Bllb_StorageDoc_tbsd.Query("where S_Doc_NO='" + s_doc_no + "'"); if (dt.Rows.Count > 0) { if (SqlInput.ChangeNullToString(dt.Rows[0]["Status"]) != "1") { new PubUtils().ShowNoteNGMsg("仅开立中的单据可以删除!", 2, grade.OrdinaryError); return; } } if (BLL_Bllb_StorageDoc_tbsd.Delete("where S_Doc_NO='" + s_doc_no + "'") == true) { Query(); new PubUtils().ShowNoteOKMsg("删除成功"); } }
public SqlInput ConvertFromJObject(JObject jObject) { SqlInput input = new SqlInput(); List <ExpandoObject> list = new List <ExpandoObject>(); var expando = JsonConvert.DeserializeObject <ExpandoObject>(jObject.ToString(Newtonsoft.Json.Formatting.None), new ExpandoObjectConverter()); list.Add(expando); input.Parameters = list; return(input); }
public static void InsertOrUpdateWipGroupStatistics(Model_Bllb_groupStatistics_tbgs obj) { //判断记录是否存在 string strSql = string.Format(@"SELECT COUNT(1) FROM T_Bllb_groupStatistics_tbgs WHERE SfcNo='{0}' AND TBTG_ID='{1}'", obj.SfcNo, obj.TBTG_ID); if (SqlInput.ChangeNullToInt(CIT.Wcf.Utils.NMS.GetTableCount(PubUtils.uContext, strSql), 0) == 0)//新增 { strSql = string.Format(@"INSERT INTO T_Bllb_groupStatistics_tbgs(SFCNO,TBTG_ID,PASS_NUM,ERROR_NUM) VALUES('{0}','{1}',{2},{3})", obj.SfcNo, obj.TBTG_ID, obj.PASS_NUM, obj.ERROR_NUM); CIT.Wcf.Utils.NMS.ExecTransql(PubUtils.uContext, strSql); } }
public SqlInput ConvertFromJArray(JArray arrary) { SqlInput input = new SqlInput(); List <ExpandoObject> list = new List <ExpandoObject>(); foreach (var item in arrary) { var expando = JsonConvert.DeserializeObject <ExpandoObject>(item.ToString(Newtonsoft.Json.Formatting.None)); list.Add(expando); } input.Parameters = list; return(input); }
private void txt_Begin_LocationSN_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { //if (Bll_Bllb_StorageDocDetail_tbsdd.IsReturn(txt_Begin_LocationSN.Text.Trim()).Rows.Count > 0) //{ // new PubUtils().ShowNoteNGMsg("物料SN已退料", 1, grade.OrdinaryError); // return; //} //校验物料SN是否在库 string check_IsInStock = string.Format(" Where SerialNumber='{0}' and Lock_Flag='7'", txt_Begin_LocationSN.Text.Trim()); DataTable dt_isInStock = Bll_Bllb_StockInfo_tbsi.QueryStock(check_IsInStock); if (dt_isInStock.Rows.Count > 0) { sfcNo = SqlInput.ChangeNullToString(dt_isInStock.Rows[0]["SfcNo"]); //输入物料SN生成退料单据号 dt_return_doc = Bll_Bllb_StorageDocDetail_tbsdd.Create_Return_Doc(txt_Begin_LocationSN.Text.Trim()); if (dt_return_doc.Rows[0]["Result"].ToString() == "0") { new PubUtils().ShowNoteNGMsg("物料SN不在发料单中", 1, grade.OrdinaryError); return; } _s_doc_no = dt_return_doc.Rows[0]["S_Doc_NO"].ToString(); _before_Doc_NO = dt_return_doc.Rows[0]["Before_Doc_NO"].ToString();//发料单 _materialCode = dt_return_doc.Rows[0]["MaterialCode"].ToString(); //_iqc_doc = Bll_Bllb_IQCDoc_tbid.GetIqcDocByMaterialCode(_materialCode, _before_Doc_NO);//输入料号生成退料送检单(屏蔽生成送检单) DataTable DIP_Qty = Bll_Bllb_StorageDocDetail_tbsdd.Query_SN_Qty(txt_Begin_LocationSN.Text.Trim(), _materialCode); if (DIP_Qty.Rows.Count > 0) { txt_Qty.Text = DIP_Qty.Rows[0]["Qty"].ToString(); txt_Qty.Focus(); txt_Qty.ReadOnly = false; } else { DataTable SMT_Qty = Bll_Bllb_StockInfo_tbsi.Query_SN_Qty(txt_Begin_LocationSN.Text.Trim(), _materialCode); if (SMT_Qty.Rows.Count > 0) { txt_Qty.Text = SMT_Qty.Rows[0]["Qty"].ToString(); txt_Qty.Focus(); txt_Qty.ReadOnly = false; } } } else { new PubUtils().ShowNoteNGMsg("物料状态不对或物料SN错误", 2, grade.OrdinaryError); return; } } }
/// <summary> /// 流程校验 /// </summary> /// <param name="serial_Number"></param> /// <param name="TBS_ID"></param> /// <returns></returns> public static string CheckRoute(string serial_Number, string TBS_ID, ref string TBTG_ID, ref string WIP_TBTG_ID) { string msg = string.Empty; //返回信息 string TBT_ID = string.Empty; //工艺ID bool is_error = false; string F_TBTG_ID = string.Empty; //产品最后过的工艺工序ID DataTable dt_Product = QueryProductSN(serial_Number); if (dt_Product.Rows.Count > 0)//已投产的产品(在制品) { #region 已投产的产品 //if (SqlInput.ChangeNullToString(dt_Product.Rows[0]["OVER_FLAG"]) == "Y") //{ // msg = "产品已流程结束"; // return msg; //} TBT_ID = SqlInput.ChangeNullToString(dt_Product.Rows[0]["TBT_ID"]);//工艺ID if (TBT_ID == string.Empty) { msg = "制令单未配置工艺"; return(msg); } F_TBTG_ID = dt_Product.Rows[0]["TBTG_ID"].ToString();//产品最后过的工艺工序ID if (dt_Product.Rows[0]["ERROR_FLAG"].ToString() == "Y") { is_error = true; } //获取工位ID对应的工艺工序ID DataTable dt_TBTG_ID = QueryTechGroup(TBT_ID, TBS_ID); if (dt_TBTG_ID.Rows.Count == 0) { msg = "工位不在当前产品所在的工艺中"; return(msg); } //流程校验 //msg = CheckRoute(TBT_ID, F_TBTG_ID, TBS_ID, is_error, ref TBTG_ID); msg = CheckRoute(TBT_ID, F_TBTG_ID, TBS_ID, is_error, ref TBTG_ID, ref WIP_TBTG_ID); if (msg != "OK") { return(msg); } return("OK"); #endregion } else { return("非首站不能进行产品投入"); } }
private void dgv_StorageMaterial_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgv_StorageMaterial.CurrentCell == null || dgv_StorageMaterial.CurrentCell.RowIndex == -1) { return; } dgvStorageDetail.DataSource = null; string queryWhere = string.Format(@" where a.S_Doc_NO='{0}' and a.MaterialCode='{1}'", SqlInput.ChangeNullToString(dgv_StorageMaterial.Rows[dgv_StorageMaterial.CurrentCell.RowIndex].Cells[S_Doc_NO_Material.Name].Value), SqlInput.ChangeNullToString(dgv_StorageMaterial.Rows[dgv_StorageMaterial.CurrentCell.RowIndex].Cells[MaterialCode.Name].Value)); dtStorageDetail = BLL_Bllb_StorageDoc_tbsd.QueryStorageDetail(queryWhere); dgvStorageDetail.DataSource = dtStorageDetail; }
/// <summary> /// 检验主料盘 /// </summary> /// <returns></returns> private bool CheckMSn() { string serialNumber = txtMsn.Text; DataTable dt_MainMaterial = Bll_Bllb_StockInfo_tbsi.ValidateSN(serialNumber); if (dt_MainMaterial.Rows.Count == 0) { new PubUtils().ShowNoteNGMsg("主料号不在库或数量为0", 1, grade.OrdinaryError); return(false); } materialcode = dt_MainMaterial.Rows[0]["MaterialCode"].ToString(); currentQty += SqlInput.ChangeNullToInt(dt_MainMaterial.Rows[0]["QTY"], 0); lblTotal.Text = currentQty.ToString(); return(true); }
/// <summary> /// 通过关键件找到产品条码 /// </summary> /// <param name="KeySN"></param> /// <returns></returns> public string GetSerialNumberByKeySN(string KeySN) { string strSql = string.Format(@"SELECT tbpi.SERIAL_NUMBER FROM T_Bllb_productInfo_tbpi tbpi left join T_Bllb_productKey_tbpk tbpk on tbpi.TBPS_ID=tbpk.TBPS_ID WHERE tbpk.KEY_SN='{0}'", KeySN); DataTable dt = NMS.QueryDataTable(PubUtils.uContext, strSql.ToString()); if (dt.Rows.Count > 0) { return(SqlInput.ChangeNullToString(dt.Rows[0][0])); } else { return(string.Empty); } }
private bool CheckData(out string msg) { msg = "OK"; if (lbLogInfo.Items.Count >= 1000) { //数据项太多了--清除 lbLogInfo.Items.Clear(); lbLogInfo.Items.Add("日志大于1000条,清空"); } if (txt_BarCode.Text == string.Empty) { msg = "料卷信息为空"; return(false); } if (txtSigleCount.Text == string.Empty) { msg = "单盘物料数量为空"; return(false); } if (txtDiskNum.Text == string.Empty) { msg = "分盘数量为空"; return(false); } DataTable dt = NMS.QueryDataTable(PubUtils.uContext, string.Format("SELECT * FROM dbo.T_Bllb_StockInfo_tbsi WHERE SerialNumber='{0}'", txt_BarCode.Text.Trim())); if (dt.Rows.Count > 0) { Location_SN = SqlInput.ChangeNullToString(dt.Rows[0]["Location_SN"]); if (!string.IsNullOrEmpty(Location_SN)) { msg = "料盘上架中"; return(false); } Lock_Flag = SqlInput.ChangeNullToString(dt.Rows[0]["Lock_Flag"]); if (!(Lock_Flag == "7" || Lock_Flag == "0")) { msg = "料盘状态不允许分盘"; return(false); } } else { msg = "料盘编号错误!"; return(false); } return(true); }
/// <summary> /// 获取下一个工艺工序ID /// </summary> /// <param name="F_TBTG_ID">父级工艺工序ID</param> /// <param name="isNormalGroup">是否为未正常工序(非维修工序)</param> /// <returns></returns> public static string GetNextTechGroupID(string F_TBTG_ID, bool isNormalGroup) { string strSql = string.Format(@"SELECT A.TBTG_ID FROM T_Bllb_techGroupRelation_tbtgr A LEFT JOIN T_Bllb_technologyGroup_tbtg B ON A.F_TBTG_ID=B.TBTG_ID LEFT JOIN T_Bllb_group_tbg C ON B.TBG_ID=C.TBG_ID WHERE A.TBTG_ID='{0}' AND C.GROUP_TYPE='{1}'", F_TBTG_ID, isNormalGroup == true?"0":"1"); DataTable dt = CIT.Wcf.Utils.NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt.Rows.Count > 0) { return(SqlInput.ChangeNullToString(dt.Rows[0][0])); } else { return(string.Empty); } }
private void Form_ReelPrint_Load(object sender, EventArgs e) { if (dgvrSelected != null) { txt_PO.Text = SqlInput.ChangeNullToString(dgvrSelected.Cells["PO订单编号"].Value); txt_MaterialCode.Text = SqlInput.ChangeNullToString(dgvrSelected.Cells["料号"].Value); } string sql_isSendCheck = string.Format(@"SELECT * FROM dbo.MdcdatMaterial WHERE MaterialCode='{0}'", txt_MaterialCode.Text.Trim()); DataTable dtCheck = NMS.QueryDataTable(PubUtils.uContext, sql_isSendCheck); if (dtCheck.Rows.Count > 0) { IsSendCheck = SqlInput.ChangeNullToString(dtCheck.Rows[0]["IsSendCheck"]) == "是" ? true : false; } txt_MPN.Focus(); }
private void Form_ShowDocDetail_Load(object sender, EventArgs e) { StringBuilder strbildLook = new StringBuilder(); foreach (DataGridViewRow dgvr in list_dgvr) { string s_doc_no = SqlInput.ChangeNullToString(dgvr.Cells["S_Doc_NO"].Value); strbildLook.AppendFormat(@" SELECT a.S_Doc_NO AS '单据号' , CASE a.S_Doc_Type WHEN c.TYPE_CODE THEN c.TYPE_NAME END AS '单据类型' , b.SerialNumber AS '条码' , b.MaterialCode AS '料号' , b.DateCode , b.QTY AS '数量' , b.MPN, a.Creator AS '创建人' , a.Create_Time AS '创建时间' , a.Before_Doc_No AS '上游单据' , CASE a.IsAutoCreate WHEN 'N' THEN '人工开单' WHEN 'Y' THEN '自动生成' ELSE '人工开单' END '是否自动生成' FROM dbo.T_Bllb_StorageDoc_tbsd AS a LEFT JOIN dbo.T_Bllb_StorageDocDetail_tbsdd AS b ON a.S_Doc_NO = b.S_Doc_NO LEFT JOIN dbo.T_Bllb_DocType_tbdt AS c ON c.TYPE_CODE = a.S_Doc_Type WHERE a.S_Doc_NO = '{0}'", s_doc_no); } if (strbildLook.Length > 0) { ds = CIT.Wcf.Utils.NMS.QueryDataSet(CIT.MES.PubUtils.uContext, strbildLook.ToString()); foreach (DataTable dt in ds.Tables) { TabPage tab_Page = new TabPage(); tab_Page.Text = SqlInput.ChangeNullToString(dt.Rows[0]["单据号"]); DataGridView t_dgvr = new DataGridView(); t_dgvr.DataSource = dt; t_dgvr.ReadOnly = true; t_dgvr.AllowUserToAddRows = false; t_dgvr.Dock = DockStyle.Fill; tab_Page.Controls.Add(t_dgvr); tab_data.TabPages.Add(tab_Page); } } }
/// <summary> /// 获取当前的料卷信息 /// </summary> /// <param name="reelid"></param> public void GetMaterialInfo(string reelid) { string querySql = string.Format(@" SELECT a.SerialNumber,a.QTY,a.Location_SN,a.Storage_SN,a.Area_SN,a.DateCode,a.MPN,f.PO,a.Lock_Flag, b.Storage_Name,c.Area_Name,d.Location_Name, a.MaterialCode FROM dbo.T_Bllb_StockInfo_tbsi AS a LEFT JOIN dbo.T_Bllb_Storage_tbs AS b ON b.Storage_SN=a.Storage_SN LEFT JOIN dbo.T_Bllb_StorageArea_tbsa AS c ON c.Area_SN=a.Area_SN LEFT JOIN dbo.T_Bllb_StorageLocation_tbsl AS d ON d.Location_SN=a.Location_SN LEFT JOIN dbo.T_Bllb_StorageDocDetail_tbsdd AS e ON e.SerialNumber=a.SerialNumber LEFT JOIN dbo.T_Bllb_StorageDoc_tbsd AS f ON f.S_Doc_NO=e.S_Doc_NO WHERE a.SerialNumber='{0}'", reelid); dt_MaterialInfo = NMS.QueryDataTable(PubUtils.uContext, querySql); if (dt_MaterialInfo.Rows.Count > 0) { Location_SN = SqlInput.ChangeNullToString(dt_MaterialInfo.Rows[0]["Location_SN"]); if (!string.IsNullOrEmpty(Location_SN)) { txt_BarCode.SelectAll(); new PubUtils().ShowNoteNGMsg("料盘上架中", 1, grade.OrdinaryError); return; } Lock_Flag = SqlInput.ChangeNullToString(dt_MaterialInfo.Rows[0]["Lock_Flag"]); if (!(Lock_Flag == "7" || Lock_Flag == "0")) { txt_BarCode.SelectAll(); new PubUtils().ShowNoteNGMsg("料盘当前状态不允许分盘", 1, grade.OrdinaryError); return; } txtHourseName.Text = dt_MaterialInfo.Rows[0]["Storage_Name"].ToString(); txtRollNum.Text = dt_MaterialInfo.Rows[0]["QTY"].ToString(); txtMaterialNo.Text = dt_MaterialInfo.Rows[0]["MaterialCode"].ToString(); txt_Reelid.Text = reelid; } else { txt_BarCode.SelectAll(); new PubUtils().ShowNoteNGMsg("料盘信息错误", 1, grade.OrdinaryError); return; } }
/// <summary> /// 校验容器条码规则 /// </summary> /// <param name="ruleName">规则名称</param> /// <param name="ContainerSN">容器SN</param> /// <param name="productCode">容器内产品的产品代码</param> /// <param name="msg"></param> /// <returns></returns> public static bool CheckContainerSNRule(string ruleName, string ContainerSN, string productCode, ref string msg) { string strSql = string.Format(@"SELECT IS_CHECK_SN_LENGTH, SN_LENGTH,IS_CHECK_SAME_STRING,SAME_STRING,SAME_STRING_BEGIN, MATERIAL_FLAG,MATERIAL_LENGTH,MATERIAL_CODE_BEGIN,SN_BEGIN FROM T_Bllb_barcodeRule_tbbr T WHERE T.RULE_NAME ='{0}'", ruleName); DataTable dt_Rule = CIT.Wcf.Utils.NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt_Rule.Rows.Count > 0) { //检验长度 if (SqlInput.ChangeNullToString(dt_Rule.Rows[0]["IS_CHECK_SN_LENGTH"]) == "Y" & SqlInput.ChangeNullToInt(dt_Rule.Rows[0]["SN_LENGTH"], 0) != ContainerSN.Length) { msg = "容器条码长度不正确"; return(false); } //校验固定字符 if (SqlInput.ChangeNullToString(dt_Rule.Rows[0]["IS_CHECK_SAME_STRING"]) == "Y") { string sameString = SqlInput.ChangeNullToString(dt_Rule.Rows[0]["SAME_STRING"]); int length = sameString.Length; int begin = SqlInput.ChangeNullToInt(dt_Rule.Rows[0]["SAME_STRING_BEGIN"], 0) - 1;//数据库保存是从1开始,实际中位置编号是从0开始,故要减1 if (ContainerSN.Substring(begin, length) != sameString) { msg = "容器条码的固定字符不正确"; return(false); } } //校验产品代码 if (SqlInput.ChangeNullToString(dt_Rule.Rows[0]["MATERIAL_FLAG"]) != "0") { int length = SqlInput.ChangeNullToInt(dt_Rule.Rows[0]["MATERIAL_LENGTH"], 0); int m_begin = SqlInput.ChangeNullToInt(dt_Rule.Rows[0]["MATERIAL_CODE_BEGIN"], 0) - 1; int sn_begin = SqlInput.ChangeNullToInt(dt_Rule.Rows[0]["SN_BEGIN"], 0) - 1; if (ContainerSN.Substring(sn_begin, length) != productCode.Substring(m_begin, length)) { msg = "容器条码中的产品代码不正确"; return(false); } } } return(true); }
private void 新增ToolStripMenuItem_Click(object sender, EventArgs e) { if (cbo_Type.SelectedValue.ToString() == "-1") { MsgBox.Error("请选择类型"); return; } string sqlcmd = string.Format("SELECT * FROM T_Bllb_SecondClass_tbsc WHERE Type='{0}' AND Class='{1}'", cbo_Type.Text, txt_Class.Text.Trim()); if (NMS.QueryDataTable(PubUtils.uContext, sqlcmd).Rows.Count > 0) { new PubUtils().ShowNoteNGMsg("该类型的等级已存在", 2, grade.RepeatedError); return; } if (cbo_Type.SelectedValue.ToString() != "2") { if (dgv_SencondClass.Rows.Count == 1) { MsgBox.Error("红胶或锡膏只允行添加一行数据"); return; } } if (dgv_SencondClass.Rows.Count != 0) { if (!ValidataInput(dgv_SencondClass.Rows[dgv_SencondClass.Rows.Count - 1])) { return; } } dgv_SencondClass.Rows.Add(); int rowindex = dgv_SencondClass.Rows.Count - 1; dgv_SencondClass.Rows[rowindex].Cells["OrderNum"].Value = rowindex + 1; if (dgv_SencondClass.Rows.Count == 2) { expose_time = SqlInput.ChangeNullToString(dgv_SencondClass.Rows[0].Cells["ExposeTime"].Value); ExposeTime.ReadOnly = true; } dgv_SencondClass.Rows[rowindex].Cells["ExposeTime"].Value = expose_time; }
private void cbo_MaterialCode_SelectedIndexChanged(object sender, EventArgs e) { //cbo_MaterialCode.TextChanged -= cbo_MaterialCode_TextChanged; txt_MaterialDesc.Text = string.Empty; if (cbo_MaterialCode.Text != string.Empty) { DataTable dt_Spec = bll_Material.SelectNameAndSpec(cbo_MaterialCode.Text.Split('*')[0]); if (dt_Spec.Rows.Count == 0) { new PubUtils().ShowNoteNGMsg("未维护该物料基础信息!", 1, grade.OrdinaryError); cbo_PO_SelectedIndexChanged(null, null); return; } else { txt_MaterialDesc.Text = SqlInput.ChangeNullToString(dt_Spec.Rows[0]["Spec"]); txt_MinPackage.Text = SqlInput.ChangeNullToInt(dt_Spec.Rows[0]["PackagingMin"], 1).ToString(); } } //cbo_MaterialCode.TextChanged += cbo_MaterialCode_TextChanged; }
/// <summary> /// 判断是否产品代码一致 /// </summary> /// <param name="tbpi"></param> /// <returns></returns> public bool CheckProductSame(T_Bllb_productInfo_tbpi tbpi, ref string msg) { // string strSql = string.Format(@"SELECT A.TBPS_ID,W.Version from T_Bllb_productInfo_tbpi A LEFT JOIN dbo.SfcDatProduct B ON A.SfcNo=B.SfcNo //LEFT JOIN dbo.T_Work_Number W ON B.WoCode=W.WoCode // where SERIAL_NUMBER = '{0}' and B.Product = '{1}' AND LAST_FLAG = 'Y' AND W.Version='{2}'", tbpi.SERIAL_NUMBER, tbpi.ProductCode,tbpi.Version); // return NMS.QueryDataTable(PubUtils.uContext, strSql).Rows.Count == 0 ? false : true; string strSql = string.Format(@"SELECT W.C_PartNumber, B.Product,A.TBPS_ID,W.Version from T_Bllb_productInfo_tbpi A LEFT JOIN dbo.SfcDatProduct B ON A.SfcNo=B.SfcNo LEFT JOIN dbo.T_Work_Number W ON B.WoCode=W.WoCode where SERIAL_NUMBER = '{0}' AND LAST_FLAG = 'Y' ", tbpi.SERIAL_NUMBER, tbpi.ProductCode, tbpi.Version); DataTable dt_check = NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt_check.Rows.Count > 0) { string str_product = SqlInput.ChangeNullToString(dt_check.Rows[0]["Product"]); //产品 string str_Version = SqlInput.ChangeNullToString(dt_check.Rows[0]["Version"]); //版本 string str_C_PartNumber = SqlInput.ChangeNullToString(dt_check.Rows[0]["C_PartNumber"]); //版本 if (str_product != tbpi.ProductCode) { msg = "产品有误,扫描产品为" + str_product; return(false); } else if (str_Version != tbpi.Version) { msg = "产品版本有误,扫描产品版本为" + str_Version; return(false); } else if (str_C_PartNumber != tbpi.C_PartNumber) { msg = "客户料号有误,扫描客户料号为" + str_C_PartNumber; return(false); } msg = string.Empty; return(true); } else { msg = "产品条码不存在"; return(false); } }
private void dgv_Menu_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dgv_Menu.Columns[e.ColumnIndex].Name == CHK.Name & e.RowIndex >= 0) { string container_type = dgv_Menu.Rows[e.RowIndex].Cells[MenuCode.Name].Value.ToString(); DataRow[] drs = dt_Menu.Select(string.Format("MenuCode='{0}'", container_type)); if (drs.Length > 0) { bool isCheck = SqlInput.ChangeBoolToValue(dgv_Menu.Rows[e.RowIndex].Cells[CHK.Name].FormattedValue, false); if (isCheck == true) { switch (drs[0]["flag"].ToString()) { case "0": drs[0]["flag"] = "2"; //新增(只有状态0才能变成2) break; case "3": drs[0]["flag"] = "1"; //有( 只有状态3才能变成1)(状态0和1都不对数据库进行操作) break; } } else { switch (drs[0]["flag"].ToString()) { case "2": drs[0]["flag"] = "0"; //无(只有状态2才能变成0)(状态0和1都不对数据库进行操作) break; case "1": drs[0]["flag"] = "3"; //删除(只有状态1才能变成3) break; } } dgv_Menu.DataSource = dt_Menu; } } }
/// <summary> /// 获取返工/维修回流的工艺工序ID /// </summary> /// <param name="TBPS_ID"></param> /// <param name="TBS_ID"></param> /// <param name="msg"></param> /// <returns></returns> public static string GetNextRe_TBTG_ID_BY_TBPS_ID(string TBPS_ID, string TBS_ID, ref string msg) { string strSql = string.Format(@"SELECT tbps.RE_TBTG_ID,tbtgs.TBTG_ID FROM T_Bllb_productInfo_tbpi tbbi left join t_bllb_productStatus_tbps tbps on tbbi.tbps_id=tbps.tbps_id LEFT JOIN SfcDatProduct sfc on tbbi.sfcno=sfc.sfcno left join T_Bllb_techGroupStation_tbtgs tbtgs on tbtgs.TBT_ID=sfc.TBT_ID left join T_Bllb_station_tbs tbs on tbs.TBS_ID=tbtgs.TBS_ID where tbbi.last_flag='Y' and tbbi.TBPS_ID='{0}' and tbs.TBS_ID='{1}'", TBPS_ID, TBS_ID); DataTable dt = CIT.Wcf.Utils.NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt.Rows.Count > 0) { string re_tbtg_id = SqlInput.ChangeNullToString(dt.Rows[0]["RE_TBTG_ID"]); if (re_tbtg_id != string.Empty & re_tbtg_id == SqlInput.ChangeNullToString(dt.Rows[0]["TBTG_ID"])) { msg = "OK"; return(re_tbtg_id); } else { if (re_tbtg_id != string.Empty) { strSql = string.Format(@"SELECT TBG.GROUP_NAME FROM T_Bllb_technologyGroup_tbtg TBTG LEFT JOIN T_Bllb_group_tbg TBG ON TBG.TBG_ID=TBTG.TBG_ID WHERE TBTG.TBTG_ID='{0}'", re_tbtg_id); DataTable dt_g = CIT.Wcf.Utils.NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt_g.Rows.Count > 0) { msg = "下一个工序为" + SqlInput.ChangeNullToString(dt_g.Rows[0][0]); } } return(string.Empty); } } else { msg = "工位不在产品工艺中"; return(string.Empty); } }
private void cbo_PO_SelectedIndexChanged(object sender, EventArgs e) { txt_MaterialDesc.Text = string.Empty; //初始化物料数据源 lstInitMaterial.Clear(); cbo_MaterialCode.Items.Clear(); lstNewMaterial.Clear(); DataTable dt_Material = BLL.Bll_Bllb_POMain_tbpm.GetList(cbo_PO.Text); if (dt_Material.Rows.Count > 0) { foreach (DataRow dr in dt_Material.Rows) { lstInitMaterial.Add(dr["MaterialCode"].ToString() + "*" + dr["RowNumber"].ToString()); } txt_SUPPLIER_CODE.Text = SqlInput.ChangeNullToString(dt_Material.Rows[0]["SupplierCode"]);//供应商代码 } else { txt_SUPPLIER_CODE.Text = string.Empty; } cbo_MaterialCode.Items.AddRange(lstInitMaterial.ToArray()); }
/// <summary> /// 产品过站 /// </summary> /// <param name="serialNumber"></param> /// <param name="TBS_ID"></param> /// <param name="TBTG_ID"></param> /// <param name="WIP_TBTG_ID"></param> /// <param name="lst_error"></param> /// <param name="msg"></param> /// <returns></returns> public static bool PassGroup(string serialNumber, string TBS_ID, string TBTG_ID, string WIP_TBTG_ID, List <string> lst_error, ref string msg) { //获取TBPS_ID(产品状态ID)、TBG_ID(工序ID)、PLCODE(线别代码) string UseId = PubUtils.uContext.UserID; //员工号 bool newInput = false; //是否新投入的产品 #region 查询产品信息 DataTable dt_Product = QueryProductSN(serialNumber);//查询产品信息 if (dt_Product.Rows.Count == 0) { msg = "不存在条码" + serialNumber; return(false); } string sfcNo = dt_Product.Rows[0]["SFCNO"].ToString(); //制令单 string TBPS_ID = dt_Product.Rows[0]["TBPS_ID"].ToString(); //产品状态ID(在产品信息表中不是唯一) string once_Over_Flag = dt_Product.Rows[0]["ONCE_OVER_FLAG"].ToString(); //是否曾经流程结束(Y/N)(针对流程结束又原单返工情况) string TBT_ID = dt_Product.Rows[0]["TBT_ID"].ToString(); //工艺ID string PLCode = SqlInput.ChangeNullToString(dt_Product.Rows[0]["LINE"]); //线别代码 #endregion #region 工艺信息 string TBG_ID = string.Empty; //工序ID string inout_Type = string.Empty; //工艺工序类型 //string TBTG_ID = string.Empty;//工艺工序ID //获取工艺工序ID对应的工艺工序信息 DataTable dt_TBTG_ID = QueryTechGroup(TBT_ID, TBTG_ID); if (dt_TBTG_ID.Rows.Count == 0) { msg = "工位不在当前产品所在的工艺中"; return(false); } else { inout_Type = SqlInput.ChangeNullToString(dt_TBTG_ID.Rows[0]["INOUT_TYPE"]);//投入产出标识 //TBTG_ID = SqlInput.ChangeNullToString(dt_TBTG_ID.Rows[0]["TBTG_ID"]);//工艺工序ID TBG_ID = SqlInput.ChangeNullToString(dt_TBTG_ID.Rows[0]["TBG_ID"]);//工序ID } #endregion #region 新增/修改产品状态信息表 //1.1、新增/修改产品状态信息表 Model_Bllb_productStatus_tbps obj_Status = new Model_Bllb_productStatus_tbps(); obj_Status.PLCode = PLCode; //线别代码 obj_Status.SfcNo = sfcNo; //制令单 obj_Status.TBTG_ID = TBTG_ID; //工艺工序ID obj_Status.WIP_TBTG_ID = WIP_TBTG_ID; //下一个工艺工序ID if (newInput == true) //新投入产品 { obj_Status.TBPS_ID = Guid.NewGuid().ToString(); //产品状态ID TBPS_ID = obj_Status.TBPS_ID; InsertProductStatus(obj_Status); //新增产品状态信息 } else//在制品 { obj_Status.TBPS_ID = TBPS_ID;//产品状态ID UpdateProductStatus(obj_Status); } #endregion #region 过站记录 Model.Model_Bllb_productPass_tbpp obj_Pass = new Model.Model_Bllb_productPass_tbpp(); obj_Pass.TBG_ID = TBG_ID; //工序ID obj_Pass.TBPP_ID = Guid.NewGuid().ToString(); //过站记录ID obj_Pass.TBPS_ID = TBPS_ID; //产品状态ID obj_Pass.PLCode = PLCode; //线别代码 obj_Pass.TBS_ID = TBS_ID; //工位ID //1.2、添加产品过站记录表 if (lst_error.Count > 0) { obj_Pass.STATE_FLAG = "1"; //不良品 InsertProductPass(obj_Pass); //不良品过站记录 foreach (string str_TBEC_ID in lst_error) { //1.3、添加不良信息 Model.Model_Bllb_productError_tbpe obj_pe = new Model.Model_Bllb_productError_tbpe(); obj_pe.ERROR_MAN = UseId; //打不良人 obj_pe.TBEC_ID = str_TBEC_ID; //不良代码ID obj_pe.TBPE_ID = Guid.NewGuid().ToString(); //不良记录ID obj_pe.TBPS_ID = TBPS_ID; //产品状态ID obj_pe.TBS_ID = TBS_ID; //工位ID obj_pe.TBG_ID = TBG_ID; //工序ID InsertProductError(obj_pe); } //1.4、产品标识为不良 UpdateErrorFlag(serialNumber);//产品标识为不良 } else { obj_Pass.STATE_FLAG = "0"; //良品 InsertProductPass(obj_Pass); //良品过站记录 } //1.4、新增产品信息 Model.Model_Bllb_productInfo_tbpi obj_Info = new Model.Model_Bllb_productInfo_tbpi(); obj_Info.QTY = 1; //数量 obj_Info.SERIAL_NUMBER = serialNumber; //产品SN if (lst_error.Count > 0) { obj_Info.ERROR_FLAG = "Y";//是否不良 } else { obj_Info.ERROR_FLAG = "N"; //是否不良 } obj_Info.LAST_FLAG = "Y"; //是否最新记录 obj_Info.OVER_FLAG = "N"; //是否流程结束 obj_Info.REPAIR_FLAG = "N"; //是否维修过 obj_Info.SCRAP_FLAG = "N"; //是否报废 obj_Info.ONCE_OVER_FLAG = "N"; //是否曾经流程结束过(是针对原单返工的情况) obj_Info.SfcNo = sfcNo; //制令单 obj_Info.TBPI_ID = Guid.NewGuid().ToString(); //唯一码 obj_Info.TBPS_ID = TBPS_ID; //产品状态ID if (inout_Type == "0" || inout_Type == "3") //主线投入或者主线投入产出标识 { obj_Info.AUXILIARY_FLAG = "N"; } else if (inout_Type == "2")//辅助线投入 { obj_Info.SERIAL_NUMBER = string.Empty; obj_Info.AUXILIARY_FLAG = "Y"; } else if (inout_Type == "1") //产出工序 { if (lst_error.Count > 0) //是否不良 { obj_Info.OVER_FLAG = "N"; //是否流程结束 obj_Info.ONCE_OVER_FLAG = once_Over_Flag; //是否曾经流程结束(Y/N)(针对流程结束又原单返工情况) } else { obj_Info.OVER_FLAG = "Y"; //是否流程结束 obj_Info.ONCE_OVER_FLAG = "Y"; //是否曾经流程结束(Y/N)(针对流程结束又原单返工情况) } } if (inout_Type == "0") //投入工序(注意考虑回流情况) { if (newInput == true) //新投入产品 { //1.4、新增产品信息 InsertProdcutInfo(obj_Info); } } else if (inout_Type == "1")//1:产出工序 { //1.4、修改产品信息表() UpdateOverTech(obj_Info); //新增产品信息 if (once_Over_Flag == "N" || obj_Info.ERROR_FLAG == "N") //是否是流程结束后又原单返工 { //1.5、修改制令单的产出数(是否流程结束过,若是则不增加制令单产出数)(注意流程结束后隔天返工情况) UpdateSfcNo_ActQty(sfcNo, 1); } } else if (inout_Type == "2")//辅助投入工序 { //1.4、修改产品信息表 if (newInput == true) //新投入产品 { InsertProdcutInfo(obj_Info); //辅助投入时,产品SN设置为空,可用于验证辅助产品是否被组合到主线产品上,为空是还没被组合,组合后为空的辅助产品条码赋值为主线产品条码 } } else if (inout_Type == "3")//投入产出工序 { //1.4、新增产品信息表 if (newInput == true)//新投入产品 { InsertProdcutInfo(obj_Info); } if (once_Over_Flag == "N")//是否是流程结束后又原单返工 { //1.5、修改制令单的产出数(是否流程结束过,若是则不增加制令单产出数)(注意流程结束后隔天返工情况) UpdateSfcNo_ActQty(sfcNo, 1); } } #endregion //if (lst_error.Count == 0) //{ // AUTO_QA(); //} #region 数据统计 Model_Bllb_groupStatistics_tbgs obj = new Model_Bllb_groupStatistics_tbgs(); if (lst_error.Count > 0) { obj.ERROR_NUM = 1;//打不良次数 } else { obj.ERROR_NUM = 0; //打不良次数 } obj.PASS_NUM = 1; //过站次数 obj.SfcNo = sfcNo; //制令单 obj.TBTG_ID = TBTG_ID; //工艺工序ID InsertOrUpdateGroupStatistics(obj); //统计过站次数和打不良次数 if (WIP_TBTG_ID != string.Empty) //下一个工序的统计信息 { obj.PASS_NUM = 0; obj.TBTG_ID = WIP_TBTG_ID; obj.ERROR_NUM = 0; InsertOrUpdateWipGroupStatistics(obj);//判断下一个工序是否有统计数据,若是没有则新增一个 } #endregion return(true); }
private void Query() { #region 所选项汇总 如:只选择仓库就对仓库汇总,只选择仓库库区就对仓库库区汇总 //StringBuilder strGroup = new StringBuilder(); //string querywhere = string.Empty; //string querycolumn = ",b.Storage_Name"; //strGroup.Append("b.Storage_Name"); //if (cbo_stockName.SelectedValue.ToString() != string.Empty) //{ // querywhere += string.Format(" AND b.Storage_Name='{0}'", cbo_stockName.Text.ToString()); //} //if (SqlInput.ChangeNullToString(cbo_area.SelectedValue) != string.Empty) //{ // querywhere += string.Format(" AND c.Area_Name='{0}'", cbo_area.Text.ToString()); // querycolumn += string.Format(",c.Area_Name"); // strGroup.Append(",c.Area_Name"); //} //if (SqlInput.ChangeNullToString(cbo_location.SelectedValue) != string.Empty) //{ // querywhere += string.Format(" AND d.Location_Name='{0}'", cbo_location.Text.ToString()); // querycolumn += string.Format(",d.Location_Name"); // strGroup.Append(",d.Location_Name"); //} //if (txt_materialCode.Text.Trim() != string.Empty) //{ // querywhere += string.Format(" AND a.MaterialCode='{0}'", txt_materialCode.Text.Trim()); //} //querycolumn += string.Format(",a.MaterialCode"); //strGroup.Append(",a.MaterialCode"); //DataTable dt_Stock = Bll_Bllb_StockInfo_tbsi.SelectAll(querywhere, querycolumn, strGroup.ToString()); //if (!dt_Stock.Columns.Contains("Area_Name")) // dt_Stock.Columns.Add("Area_Name"); //if (!dt_Stock.Columns.Contains("Location_Name")) // dt_Stock.Columns.Add("Location_Name"); //if (!dt_Stock.Columns.Contains("MaterialCode")) // dt_Stock.Columns.Add("MaterialCode"); //if (!dt_Stock.Columns.Contains("QTY")) // dt_Stock.Columns.Add("QTY"); //dtSource = dt_Stock.Copy(); //dgv_stockAll.DataSource = dtSource; #endregion #region 仓库库区库位料号都带出来 string strWhere = " Where 1=1 "; if (cbo_stockName.SelectedValue.ToString() != string.Empty) { strWhere += string.Format(" AND b.Storage_Name='{0}' ", cbo_stockName.Text); } if (SqlInput.ChangeNullToString(cbo_area.SelectedValue) != string.Empty) { strWhere += string.Format(" AND c.Area_Name='{0}'", cbo_area.Text); } if (SqlInput.ChangeNullToString(cbo_location.SelectedValue) != string.Empty) { strWhere += string.Format(" AND d.Location_Name='{0}'", cbo_location.Text); } if (txt_materialCode.Text.Trim() != string.Empty) { strWhere += string.Format(" AND a.MaterialCode='{0}'", txt_materialCode.Text.Trim()); } DataTable dt = Bll_Bllb_StockInfo_tbsi.SelectStock(strWhere); dgv_stockAll.DataSource = dt; #endregion }
/// <summary> /// 打印外包装标签 /// </summary> /// <param name="SN"></param> /// <returns></returns> public static bool PrintContain_1_Info(string SN, string lableName, ref string msg) { if (SN == string.Empty) { msg = "箱条码不能为空"; return(false); } else if (lableName == string.Empty) { msg = "打印标签不能为空"; return(false); } Model.Model_PackageInfo _obj_PackageInfo = new Model_PackageInfo(); T_Bllb_packageOne_tbpo tbpo = new T_Bllb_packageOne_tbpo(); string strSql = string.Format(@"select isnull(SUM(tbpi.QTY),0) as QTY,sfc.PO,tbpo.CONTAINER_SN_1 AS BOXID, SFC.Product AS PRODUCTCODE,'12个月' as ACTIVE_LENGTH from T_Bllb_packageOne_tbpo as tbpo inner join T_Bllb_productInfo_tbpi as tbpi on tbpo.TBPS_ID=tbpi.TBPS_ID inner join SfcDatProduct sfc on sfc.SfcNo=tbpi.SfcNo where tbpo.CONTAINER_SN_1='{0}' GROUP BY sfc.PO,tbpo.CONTAINER_SN_1,SFC.Product", SN); DataTable dt_qty = NMS.QueryDataTable(PubUtils.uContext, strSql.ToString()); if (dt_qty.Rows.Count == 0) { msg = "条码不是箱条码"; return(false); } _obj_PackageInfo.QTY = SqlInput.ChangeNullToInt(dt_qty.Rows[0]["QTY"], 0).ToString();//容器实装数量 if (_obj_PackageInfo.QTY == "0") { msg = "箱子中没有产品"; return(false); } _obj_PackageInfo.PO = SqlInput.ChangeNullToString(dt_qty.Rows[0]["PO"]); _obj_PackageInfo.PRODUCTCODE = SqlInput.ChangeNullToString(dt_qty.Rows[0]["PRODUCTCODE"]); _obj_PackageInfo.P1 = SqlInput.ChangeNullToString(dt_qty.Rows[0]["PRODUCTCODE"]); _obj_PackageInfo.ACTIVE_LENGTH = "12个月"; _obj_PackageInfo.BEGIN_DATE = DateTime.Now.ToString("yyyyMMdd"); _obj_PackageInfo.END_DATE = DateTime.Now.AddMonths(12).ToString("yyyyMMdd"); _obj_PackageInfo.E1 = DateTime.Now.AddMonths(12).ToString("yyyyMMdd"); _obj_PackageInfo.BOXID = SqlInput.ChangeNullToString(dt_qty.Rows[0]["BOXID"]); if (Bll_Common.GetSysParameter("DZ", "DZ006", ref msg)) { string[] strs = msg.Split('|'); if (strs.Length >= 2) { _obj_PackageInfo.SUPPLIER = strs[0]; _obj_PackageInfo.SUPPLIER_CODE = strs[1]; } else { msg = "在系统参数【单值】中的【DZ006】配置供应商信息"; return(false); } } else { msg = "在系统参数【单值】中的【DZ006】配置供应商信息"; return(false); } if (_obj_PackageInfo.PrintOwn(lableName)) { //标识为已打印外包装标签 strSql = string.Format("update T_Bllb_packageOne_tbpo set PRINT_FLAG='Y' where CONTAINER_SN_1='{0}'", tbpo.CONTAINER_SN_1); NMS.ExecTransql(PubUtils.uContext, strSql); } return(true); }