| | |
| | | try |
| | | { |
| | | //判断所扫条码是否存在条码档案当中 |
| | | ds = oCN.RunProcReturn(@"select 1 from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //条码档案中没有本次扫描的条码,则根据规则解析生成条码 |
| | | //ds = oCN.RunProcReturn(@"select 1 from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | //if (ds.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // //条码档案中没有本次扫描的条码,则根据规则解析生成条码 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "该条码不存在:" + HBarCode; |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "该条码不存在:" + HBarCode; |
| | | // objJsonResult.data = ""; |
| | | // return objJsonResult; |
| | | |
| | | } |
| | | //} |
| | | |
| | | //条码档案中已有本次扫描的条码,查询配件信息(扫描条码信息写入临时表) |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomBindByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HBarCode_P + "','" + HProcID + "','" + HOrgID + "'", "h_p_Gy_BarCodeBillBomBindByHProcExch_XW"); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 蓝牙测试数据接口 |
| | | [Route("Cj_SingleStation/BluetoothTestDataSave")] |
| | | #region 蓝牙标签生成 |
| | | [Route("Cj_SingleStation/BlueToothBarCodeSave")] |
| | | [HttpGet] |
| | | public object BluetoothTestDataSave(string HBarCode_SN, string HBluetooth_Mac, string HResult) |
| | | public object BlueToothBarCodeSave(string HBarCode, int HMaterID,int HOrgID ,string user) |
| | | { |
| | | try |
| | | { |
| | | //判断有没有过打印记录(条码档案中存不存在蓝牙mac地址) |
| | | ds = oCN.RunProcReturn("select 1 from Gy_BarCodeBill with(nolock) where HBarCode = '" + HBluetooth_Mac + "'", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count < 1) |
| | | //生成权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "上传的HBarCode_SN:" + HBarCode_SN + ",没有标签打印记录,请先打印蓝牙mac标签:" + HBluetooth_Mac; |
| | | objJsonResult.Message = "无条码生成权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = string.Format($@"insert into Gy_BluetoothTestData(HBarCode_SN,HBluetooth_Mac,HResult,HResult) values ('{HBarCode_SN}','{HBluetooth_Mac}','{HResult}',getdate() "); |
| | | string sql = "exec h_p_Cj_BlueToothBarCodeSave '" + HBarCode + "'," + HMaterID + "," + HOrgID + ",'" + user + "'"; |
| | | |
| | | oCN.BeginTran(); |
| | | ds = oCN.RunProcReturn(sql, "h_p_Cj_BlueToothBarCodeSave"); |
| | | oCN.Commit(); |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败没有返回任何内容!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]保存失败" + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-1-050]保存成功!"; |
| | | objJsonResult.data = "";// |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 蓝牙测试数据接口 |
| | | [Route("Cj_SingleStation/BluetoothTestDataSave")] |
| | | [HttpGet] |
| | | public object BluetoothTestDataSave(string lotSn, string testData) |
| | | { |
| | | try |
| | | { |
| | | //判断有没有过打印记录(条码档案中存不存在蓝牙mac地址) |
| | | ds = oCN.RunProcReturn("select 1 from Gy_BarCodeBill with(nolock) where HBarCode = '" + lotSn + "'", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count < 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "上传的lotSn:" + lotSn + ",没有标签打印记录,请先打印蓝牙mac标签" ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = string.Format($@"insert into Gy_BluetoothTestData(HBluetooth_Mac,HResult,HMakeDate) values ('{lotSn}','{testData}',getdate() ) "); |
| | | |
| | | oCN.RunProc(sql);//插入蓝牙测试数据 |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.code = "success"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "蓝牙测试数据结束成功!HBarCode_SN:" + HBarCode_SN + " ,HBluetooth_Mac:" + HBluetooth_Mac; |
| | | objJsonResult.Message = "蓝牙测试数据接收成功!lotSn:" + lotSn; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.code = "error"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "发生异常!" + e.ToString(); |
| | | objJsonResult.data = null; |