|  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipFileMainList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //objJsonResult.code = "0"; | 
|---|
|  |  |  | //objJsonResult.count = 0; | 
|---|
|  |  |  | //objJsonResult.Message = "无数据"; | 
|---|
|  |  |  | //objJsonResult.data = null; | 
|---|
|  |  |  | //return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DLL.ClsGy_EquipFileMain oBill = new DLL.ClsGy_EquipFileMain(); | 
|---|
|  |  |  | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from Gy_EquipFileBillMain where HInterID=" + HItemID, "Gy_EquipFileBillMain"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据当前处于不能删除状态!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("Delete From Gy_EquipFileBillMain  where HInterID=" + lngBillKey); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | string HLogo = list[0].HLogo;                //√      varchar(50)   //品牌 | 
|---|
|  |  |  | int HSellSupID = list[0].HSellSupID;              // √   int      //供应商(Gy_Supplier) | 
|---|
|  |  |  | int HMakeSupID = list[0].HMakeSupID;              // int      //制造商 (Gy_Supplier) | 
|---|
|  |  |  | string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //是否主生产设备(否,是) | 
|---|
|  |  |  | string HMacAddress = list[0].HMacAddress;   // varchar(50) //数采物理地址 | 
|---|
|  |  |  | int HMainSourceID = list[0].HMainSourceID;  //int //所属主生产设备(Gy_EquipFileBillMain) | 
|---|
|  |  |  | string HMaker = msg4; | 
|---|
|  |  |  | string HMakeDate = DateTime.Now.Date.ToString(); | 
|---|
|  |  |  | int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID; | 
|---|
|  |  |  | 
|---|
|  |  |  | oCN.RunProc("Insert into Gy_EquipFileBillMain " + | 
|---|
|  |  |  | " (hbillno,HEquipFileNumber,HEquipFileNo,HName,HModel,HModel2,HMaterID,HUnitID,HOutComDate" + | 
|---|
|  |  |  | ",HOutComNo,HDeptID,HUseEmpID,HRepairEmpID,HAddress,HSetupDate,HStartupDate,HStatus," + | 
|---|
|  |  |  | "HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID) " + | 
|---|
|  |  |  | "HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID) " + | 
|---|
|  |  |  | " Values('" + hbillno + "','" + HEquipFileNumber + "','" + HEquipFileNo + "','" + HName + "','" + HModel + "','" + HModel2 + "'," + HMaterID + "," + HUnitID + | 
|---|
|  |  |  | ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HUseEmpID + "," + HRepairEmpID + ",'" + HAddress + | 
|---|
|  |  |  | "','" + HSetupDate + "','" + HStartupDate + "','" + HStatus + "'," + HEquipFileTypeID + ",'" + HProNum + | 
|---|
|  |  |  | "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ")", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "')", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | //修改上级为非末级代码 | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | 
|---|
|  |  |  | string HLogo = list[0].HLogo;                //√      varchar(50)   //品牌 | 
|---|
|  |  |  | int HSellSupID = list[0].HSellSupID;              // √   int      //供应商(Gy_Supplier) | 
|---|
|  |  |  | int HMakeSupID = list[0].HMakeSupID;              // int      //制造商 (Gy_Supplier) | 
|---|
|  |  |  | string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //是否主生产设备(否,是) | 
|---|
|  |  |  | string HMacAddress = list[0].HMacAddress;   // varchar(50) //数采物理地址 | 
|---|
|  |  |  | int HMainSourceID = list[0].HMainSourceID;  //int //所属主生产设备(Gy_EquipFileBillMain) | 
|---|
|  |  |  | string HUpDater = msg4; | 
|---|
|  |  |  | string HUpDateDate = DateTime.Now.Date.ToString(); | 
|---|
|  |  |  | int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID; | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HLogo='" + HLogo + "'" + | 
|---|
|  |  |  | ",HSellSupID=" + HSellSupID + | 
|---|
|  |  |  | ",HMakeSupID= " + HMakeSupID + | 
|---|
|  |  |  | ",HUpDater= '" + HUpDater + "'" + | 
|---|
|  |  |  | ",HUpDater= '" + HUpDater + "'" + | 
|---|
|  |  |  | ",HUpDateDate= '" + HUpDateDate + "'" + | 
|---|
|  |  |  | ",HEquipDotCheckRuleInterID='" + HEquipDotCheckRuleInterID + "'" + | 
|---|
|  |  |  | ",HEquipMaintainRuleInterID='" + HEquipMaintainRuleInterID + "'" + | 
|---|
|  |  |  | ",HSourceID='" + HSourceID + "'" + | 
|---|
|  |  |  | ",HMainSourceFlag= '" + HMainSourceFlag + "'" + | 
|---|
|  |  |  | ",HMacAddress= '" + HMacAddress + "'" + | 
|---|
|  |  |  | ",HMainSourceID = '" + HMainSourceID + "'" + | 
|---|
|  |  |  | " Where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | //修改子项目代码 | 
|---|
|  |  |  | //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 设备PDA模块 扫码 | 
|---|
|  |  |  | [Route("Gy_EquipFileBill/txtHBarCode_KeyDown")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object txtHBarCode_KeyDown(string HBarCode, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<object> columnNameList = new List<object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (HBarCode == null || HBarCode.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "条码信息为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql = "select * from h_v_Gy_EquipFileBill_KeyDown_PDA where 条形码 = '" + HBarCode + "'"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Gy_EquipFileBill_KeyDown_PDA"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //添加列名 | 
|---|
|  |  |  | foreach (DataColumn col in ds.Tables[0].Columns) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Type dataType = col.DataType; | 
|---|
|  |  |  | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|---|
|  |  |  | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | objJsonResult.list = columnNameList; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "设备条码:" + HBarCode + " ,没有创建此设备档案"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | objJsonResult.list = columnNameList; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|