|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有采购经理权限 | 
|---|
|  |  |  | bool isCgjl = Security_Log("Cg_POOrderBill_PurchasManager", 1, false, user); | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBillQuery", 1, false, user)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "无权限查看!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //string sql = "select * from h_v_IF_POOrderBillList where 1 = 1 "; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if (sWhere=="" || sWhere == null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    ds = oCN.RunProcReturn(sql+ " order by hmainid desc", "h_v_IF_POOrderBillList"); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    ds = oCN.RunProcReturn(sql + sWhere+ " order by hmainid desc", "h_v_IF_POOrderBillList"); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断是否有采购经理权限(安瑞) | 
|---|
|  |  |  | bool isCgjl = Security_Log("Cg_POOrderBill_PurchasManager", 1, true, user); | 
|---|
|  |  |  | if (!isCgjl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sWhere += $" and HEmpID in (select HEmpID from Gy_Czygl where Czymc='{user}' )"; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 采购订单重新同步 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | ///返回值:object。 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Cg_POOrderBill/Resynchronize")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Resynchronize(string HBillNo,string HBillType) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet DS = oCn.RunProcReturn("exec h_p_WMS_ERPSourceBillToLocal '" + HBillNo + "','"+ HBillType + "'", "h_p_WMS_ERPSourceBillToLocal"); | 
|---|
|  |  |  | if (DS == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据同步失败"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBack"]) == "2") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "ERP中不存在该单据号"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "单据同步成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [Route("POOrderBack")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | /// <summary> | 
|---|