|  |  | 
 |  |  |     public class Sc_ProcessExchangeBillController : ApiController | 
 |  |  |     { | 
 |  |  |         public DBUtility.ClsPub.Enum_BillStatus BillStatus; | 
 |  |  |         public const string ModName = "3772";                   //单据类型 | 
 |  |  |         public const string ModCaption = "工序流转卡";          //单据名称 | 
 |  |  |         public const string ModRightName = "Sc_ProcessExchangeBill"; | 
 |  |  |         public const string ModRightNameList = ModRightName + "List";       //列表 | 
 |  |  |         public const string ModRightNameEdit = ModRightName + "_Edit";      //编辑 | 
 |  |  |         public const string ModRightNameCheck = ModRightName + "_Check";    //审核 | 
 |  |  |         public const string ModRightNameClose = ModRightName + "_Close";    //关闭 | 
 |  |  |         public const string ModRightNameDelete = ModRightName + "_Delete";  //作废 | 
 |  |  |         public const string ModRightNameDrop = ModRightName + "_Drop";      //删除 | 
 |  |  |         private json objJsonResult = new json(); | 
 |  |  |         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |         DataSet ds; | 
 |  |  | 
 |  |  |                                                 工作中心 HCenterName,HSupID,供应商代码 HSupNumber,供应商 HSupName,isEntrust HSupFlag,计划数量 HQty,加工单价 HOutPrice, 表体备注 HRemark, | 
 |  |  |                                             进站关联数量 HRelationQty_In,出站关联数量 HRelationQty_Out,委外工单数量 HRelationQty_WWOrder,不合格数量 HRelationQty_Bad,超额比例 HOverRate, | 
 |  |  |                                             良率 HPassRate,累计良率 HSumPassRate,图纸编号 HPicNum,本工序确认记录 HProcCheckNote,工艺参数 HTechnologyParameter,HDeptID, | 
 |  |  |                                             加工车间代码 HDeptNumber,加工车间 HDeptName,出站报废关联数量 HRelationQty_OutBad | 
 |  |  |                                             加工车间代码 HDeptNumber,加工车间 HDeptName,出站报废关联数量 HRelationQty_OutBad,SN过站控制 HSNCtrl | 
 |  |  |                                             from h_v_Sc_ProcessExchangeBillQuerySub"); | 
 |  |  |                 ds = oCN.RunProcReturn(sql+ " where hmainid="+ HInterID + "  order by cast(流水号 as int) ", "h_v_Sc_ProcessExchangeBillQuerySub"); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 string sql = string.Format(@"select * from h_v_Sc_ProcessExchangeBillQuerySub"); | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn(sql + " where hmainid=" + HInterID + " and 出站关联数量=0  and  cast(流水号 as int)>" + ds1 .Tables[0].Rows[0][0].ToString(), "h_v_Sc_ProcessExchangeBillQuerySub"); | 
 |  |  |                 ds = oCN.RunProcReturn(sql + " where hmainid=" + HInterID + " and 出站关联数量=0  and  cast(流水号 as int)>" + ds1 .Tables[0].Rows[0][0].ToString()+ " order by  cast(流水号 as int) ", "h_v_Sc_ProcessExchangeBillQuerySub"); | 
 |  |  |  | 
 |  |  |                 if (float.Parse(ds.Tables[0].Rows[0]["进站关联数量"].ToString()) > 0) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     int num = oItem.HBillNo.Split('-').Length; | 
 |  |  |                     oBill.omodel.HMaker = msg5;  //制单人 | 
 |  |  |                     oBill.omodel.HNo = DBUtility.ClsPub.isLong(oItem.HBillNo.Split('-')[1]); | 
 |  |  |                     oBill.omodel.HNo = DBUtility.ClsPub.isLong(oItem.HBillNo.Split('-')[num - 1]); | 
 |  |  |                     oBill.omodel.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
 |  |  |                     oBill.omodel.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); | 
 |  |  |                     oBill.omodel.HDate = oItem.HDate;// 日期 | 
 |  |  | 
 |  |  |                     oBill.omodel.HPlanEndDate = oItem.HPlanEndDate;// 计划完工日期 | 
 |  |  |                     oBill.omodel.HQty = oItem.HQty;// 数量 | 
 |  |  |                     oBill.omodel.HBillNo = oItem.HBillNo;// 单据号 | 
 |  |  |                     oBill.omodel.HProjectNum = oItem.HProjectNum;// 项目号 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //表体数据 | 
 |  |  | 
 |  |  |                         j++; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //保存 | 
 |  |  |                 //保存完毕后处理 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         #region 工序流转卡列表 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取工序流转卡列表信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Sc_ProcessExchangeBillController/GetSc_ProcessExchangeBillList_Json")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSc_ProcessExchangeBillList_Json(string sWhere, string HMaker, string OperationType, string ViewName) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断权限 | 
 |  |  |                 if (OperationType == "1") | 
 |  |  |                 { | 
 |  |  |                     //判断权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "您没有该模块权限,请与管理员联系!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //返回列表信息 | 
 |  |  |                 ds = oCN.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName); | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //添加列名 | 
 |  |  |                 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 = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "查询列表信息失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |